0.2.5 • Published 3 years ago

gbits-cli-dev v0.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

gbits-cli-dev

The gbits-cli tool enables users to send money, view account information, and view transaction histories via the command line.

Setup

To install the gbits-cli-dev, 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-dev

Install from Source

To install globally from source, download the latest source from GitHub. Run the following commands in the source code directory:

npm i
npm link

Uninstall

To uninstall gbits-cli-dev, run the following command:

npm un -g gbits-cli-dev

Configuration

gbits-cli-dev 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 (Environments)

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

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.

NameParametersDescription
users:uidEndpoint for users and user transactions
sendnoneEndpoint for sending money

Defaults

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.

Settings

NameTypeDescription
max_amount_promptnumberThe maximum amount being sent before being prompt to confirm the transaction.

Commands

You can find all the information you need on how to use gbits-cli-dev commands below, or by typing the command:

gbc --help

Global Options

OptionDescription
-V, --versionOutput the version number
--verboseOutputs debug information
-n, --env <name>Changes the environment
-h, --helpDisplays global help

gbc account|acc

Command displays an account's information.

OptionDescription
-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, --helpDisplays help for command

Note: If the --uid and the --email option are both present, --uid is only used.

gbc txhistory|txh

Command displays an account's transaction history.

OptionDescription
-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, --helpDisplays help for command

Note: If the --uid and the --email option are both present, --uid is only used.

gbc send|snd

Command sends money to the recipient.

OptionDescription
-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, --helpDisplays help for command

Note: If the --uid and the --email option are both present, --uid is only used.

  $ gbc send -e fiveblue@gmail.com -r joe.example@gmail.com -a 9 -c GEE -m "cli-test 5"
Gbits successfully send.

Fat Finger example

$ gbc send -e fiveblue@gmail.com -r joe.example@gmail.com -a 12000 -c GEE -m "cli-test 7"
Are you sure you want to send 12000 gbits? (Y/n)