Add README
This commit is contained in:
parent
fc353daf52
commit
b7701ddc1f
3 changed files with 67 additions and 2 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Dimitri Lozeve
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
44
README.org
Normal file
44
README.org
Normal file
|
@ -0,0 +1,44 @@
|
|||
* SNCF Bot
|
||||
|
||||
** Usage
|
||||
|
||||
Get an access to the [[https://www.digital.sncf.com/startup/api][SNCF API]]. By creating an account, you should
|
||||
receive an email with your authentication key.
|
||||
|
||||
You can now call the program with the authentication key as the first
|
||||
argument.
|
||||
|
||||
#+begin_src sh
|
||||
$ sncf <sncf-key>
|
||||
┌────────────┬────────────────────────────────┬───────────────┐
|
||||
│ Réseau │ Direction │ Heure │
|
||||
├────────────┼────────────────────────────────┼───────────────┤
|
||||
│ TRANSILIEN │ Paris Saint-Lazare (Paris) │ 08:41 │
|
||||
│ TER │ Paris Saint-Lazare (Paris) │ 08:54 │
|
||||
│ TER │ Rouen Rive Droite (Rouen) │ 09:07 │
|
||||
│ TRANSILIEN │ Paris Saint-Lazare (Paris) │ 09:41 │
|
||||
│ TER │ Paris Saint-Lazare (Paris) │ 09:55 │
|
||||
│ TER │ Paris Saint-Lazare (Paris) │ 10:58 │
|
||||
│ TER │ Rouen Rive Droite (Rouen) │ 11:05 │
|
||||
│ TRANSILIEN │ Paris Saint-Lazare (Paris) │ 11:37 │
|
||||
│ TER │ Paris Saint-Lazare (Paris) │ 12:56 │
|
||||
│ TER │ Rouen Rive Droite (Rouen) │ 13:06 │
|
||||
└────────────┴────────────────────────────────┴───────────────┘
|
||||
#+end_src
|
||||
|
||||
If you want to publish to [[https://mattermost.com/][Mattermost]], create an [[https://developers.mattermost.com/integrate/webhooks/incoming/][incoming webhook]] by
|
||||
going to *Product menu* (top left) → *Integrations* → *Incoming
|
||||
webhooks*.
|
||||
|
||||
Use the ~--mattermost-url~ option to set the webhook URL and post to
|
||||
Mattermost. Optionally, you can override the default channel of the
|
||||
webhook with ~--channel~.
|
||||
|
||||
** Building instructions
|
||||
|
||||
The build script will use Docker to build a fully static executable.
|
||||
The Dockerfile is based on the [[https://hub.docker.com/r/gerbil/alpine][gerbil/alpine]] image.
|
||||
|
||||
#+begin_src sh
|
||||
$ ./build.sh
|
||||
#+end_src
|
4
build.sh
4
build.sh
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eux
|
||||
|
||||
docker build . -t dlozeve/sncf
|
||||
CONTAINER_ID=$(docker run -d dlozeve/sncf)
|
||||
docker build . -t dlozeve/sncf-bot
|
||||
CONTAINER_ID=$(docker run -d dlozeve/sncf-bot)
|
||||
docker cp "$CONTAINER_ID":/src/sncf .
|
||||
docker rm -f "$CONTAINER_ID"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue