CLI client - nimaaskarian/goje GitHub Wiki
goje
's tcp server listens to localhost:7800
by default. this can be changed in the configuration, however code here assumes the default.
i suggest you take a look at environment variables, and set and use the $GOJE_TCP_ADDRESS
variable for a more persistent configuration.
the tcp does all things you may need to control your timer. its even more robust than the webgui (you can't seek to a time on webgui, you can using the tcp daemon). its commands are clear and self-explanatory.
goje
doesn't have a cli client software, as it would only mean re-writing software that exist on most desktop systems already (like netcat
or any implementation of it, or bash's > /dev/tcp/address/port
).
to list all commands of goje
, you can send commands\n
to localhost:7800
. actually all the commands work this way.
using nc
:
echo commands | nc localhost 7800 -q0
as you can see the first and the last line are OK
signals. you can remove them using tail and head
echo commands | nc localhost 7800 -q0 | tail +2 | head -n -1
this may call for a script.
#!/usr/bin/env bash
echo "$@" | nc localhost 7800 -q0 | tail +2 | head -n -1
and save as gojec
or something.
- pause <0|1|none>
- seek <(+/-)duration>
- reset
- init
- prev
- next
- skip
- sessions <(+/-)int>
- timer
- commands
the above list is produced using the command below, then edited
echo commands | nc localhost 7800 -q0 | tail +2 | head -n -1 | cut -f 2 -d ' ' | xargs printf "- %s\n"
for commands that don't retrieve information and only control, you can actually use the > /dev/tcp/localhost/7800
syntax in bash.
e.g.
# toggle-pauses the timer
echo pause > /dev/tcp/localhost/7800
# both skip to next mode
echo skip > /dev/tcp/localhost/7800
echo next > /dev/tcp/localhost/7800