The gbits-cli
tool enables users to send money, view account information, and view transaction histories via the command line.
To install the gbits-cli
, you first need to install Node.js (versions between LTS
and v16.4.2
). This guide will help you get through the Node.js install process. If you wish to install the CLI via npm, run the command below in your favorite terminal:
npm i -g gbits-cli
To install globally from source, download the latest source from GitHub. Run the following commands in the source code directory:
npm i
npm link
To uninstall gbits-cli
, run the following command:
npm un -g gbits-cli
gbits-cli
configuration file contains option defaults and environment information to make the CLI easier and more robust. The configuration file is formatted using TOML and is located at ~/gbc.config.toml
. When you first run gbc
it will copy the default config if the file isn't found. Here is an example of the config file:
[hosts]
mock = "http://localhost:22222/mock/"
[paths]
users = "/users/:uid"
send = "/send"
[defaults]
env = "mock"
currency = "GEE"
email = "someguy@gmail.com"
uid = "c44dc8f4edb3f2b002145041"
secret = "123456-123"
[settings]
max_amount_prompt = 0
Hosts is a keyed list of hosts that the CLI can access via the --env
option. Selecting an environment switches which host is used when sending HTTP requests.
Paths is a keyed list containing information about endpoints for the hosts. Different paths are used in various commands and have their own URL parameters.
Name | Parameters | Description |
---|---|---|
users |
:uid |
Endpoint for users and user transactions |
send |
none | Endpoint for sending money |
Defaults is a keyed list for adding default values to options when executing commands. If the option is given explicitly, then the default is ignored.
Name | Type | Description |
---|---|---|
max_amount_prompt |
number |
The maximum amount being sent before being prompt to confirm the transaction. |
You can find all the information you need on how to use gbits-cli
commands below, or by typing the command:
gbc --help
Option | Description |
---|---|
-V, --version |
Output the version number |
--verbose |
Outputs debug information |
-n, --env <name> |
Changes the environment |
-h, --help |
Displays global help |
Command displays an account's information.
Option | Description |
---|---|
-u, --uid <id> |
Finds account using this user id |
-e, --email <email> |
Finds account using this email |
-s, --secret <secret> |
Secret used instead of default |
-h, --help |
Displays help for command |
Note: If the --uid
and the --email
option are both present, --uid
is only used.
Command displays an account's transaction history.
Option | Description |
---|---|
-u, --uid <id> |
Finds account using this user id |
-e, --email <email> |
Finds account using this email |
-s, --secret <secret> |
Secret used instead of default |
--show-only <received|sent> |
Show's only received or sent transactions |
-h, --help |
Displays help for command |
Note: If the --uid
and the --email
option are both present, --uid
is only used.
Command sends money to the recipient.
Option | Description |
---|---|
-u, --uid <id> |
Finds account using this user id |
-e, --email <email> |
Finds account using this email |
-s, --secret <secret> |
Secret used instead of default |
-r, --recipient-email <email> |
Email of the recipient |
-a, --amount <amount> |
Amount of money to send |
-c, --currency <code> |
Currency of the money |
-m, --message <msg> |
Message being sent with the money |
-h, --help |
Displays help for command |
Note: If the --uid
and the --email
option are both present, --uid
is only used.