FINGI-CLI
Installation
You will need node v0.10.21 and npm v1.3.11 (comes with node) or a more recent
version in order to start using it.
Once you have node
and npm
on your machine, install with:
$ npm install -g fingi
Or just add sudo
if you need root access:
$ sudo npm install -g fingi
This should installs you a fingi
script in your $PATH
. The script also creates a
lmdb database at $HOME/.fingi
for storing device credentitals for convenience.
Cleaning / Uninstallation.
Remove the $HOME/.fingi
folder from your machine to start over with a fresh
installation.
Uninstalls by simply removing the module from your global install:
$ npm rm -g fingi
ENVIRONMENT
You can switch between staging and production environment by exporting a NODE_ENV
environment variable before running the command:
$ NODE_ENV=staging fingi connect cli-test
$ NODE_ENV=production fingi connect cli-test
Or you can set the env
configuration key directly so the CLI use the given
environment by default.
$ fingi set env production
COMMANDS
fingi help [command]
Shows the help, obviously.
fingi register [--insecure] device-id
Sends an HTTP register POST message to the Fingi Operational Services server to obtain
authentication information for the specified device-id
. The device must be added to the
FOS first before this call will work.
Afterwards, the command will saves the returned authorization token and secret for you
automatically for use with other commands.
Specify --insecure
to bypass SSL errors.
fingi auth device-id auth-token auth-secret
Alternatively, you can set the authorization token and secret to use with the specified
device-id
directly by using this command.
fingi connect [--insecure]\ [device-id]
Connects to the Fingi messsaging hub over an SSL connection. If a device-id
is specified
and there is authorization information saved for it previously, then an IDENTIIFY
line
is constructed and sent automatically for you to authorizes the connection as soon as it
is established.
Omit the device-id
to connects manually or experiment in unauthorized connection mode.
After the connection is established, typing into STDIN will send it directly to the hub.
Type QUIT
to terminate the connection.
Specify --insecure
to bypass SSL errors.
fingi room [--insecure]\ device-id [json_path]
Sends an HTTP GET request to the Fingi Operational Services server to obtain current room
information for the specified device-id
. The device must be properly added to the FOS
and registered (via auth
or register
command) for this request to work.
Optionally you can provide a json_path
which will be used to select specific values from
JSON object returned from the API. Google "JSONPath" for more information.
Specify --insecure
to bypass SSL errors.
fingi show
Shows everything that's saved into your local database.
fingi show (key|device-id)
Shows information about device-id
or the specified key
that is saved in your local
database.
fingi get key [json_path]
Prints the raw value of the specified key
from your local database.
Optionally you can provide a json_path
which, if the result is a valid JSON, will be
used to select specific value to be printed instead. Google "JSONPath" for more
information.
fingi set key value
Saves the given value to the specified key
in your local database. value
is
automatically converted to JSON when possible.
fingi rm key
Removes a key from your local database. You can use this to remove information about
device you no longer need or to reset configuration to default, for example.
LICENSE
MIT. See the LICENSE file for the full text.