What’s Cli Terminal
In general, most frameworks provide Cli terminal
tools to execute some tool scripts from the command line
The Cli terminal
tools provided by CabloyJS are different. CabloyJS provides a powerful cli terminal engine
, which is composed of Cli terminal runtime
+ numerous commands
. The commands are provided by specific business modules. Therefore, we can dynamically add the commands by installing some business modules, so as to make the Cli terminal
of CabloyJS extremely powerful and easy to use
Features
-
Infinite Commands
: The commands are provided by the business module so that it can be expanded infinitely -
Support both
local development
andremote production
environments: When we enter instructions on the command line, the system will automatically call the API services at backend. The backend service can be either a development service running locally or a production environment running remotely -
Simplify
operation
andmaintenance
: Because theCli terminal
can be used in the production environment, many operation and maintenance work can be exposed through the API services, so it can be driven directly through the command line -
Perfect authorization controls: All API services exposed by the backend are controlled by the resource authorization mechanism, and the
Cli terminal
has controlled access through theopen auth token
mechanism
How to use
The usage specifications of Cli terminal
are as follows:
- 1$ npm run cli [command] [args] -- [options]
- command
Naming Conventions
: Since commands are provided by the business module, in order to further standardize management, the commands provided are grouped within the business module. Therefore, the command naming convention is as follows:
- 1moduleName:groupName:commandName
For example, the module a-clibooster
provides a group of create
, and the group of create
provides a command of module
. The complete command name is: a-clibooster:create:module
-
Special conventions
: In order to simplify the command input, the following conventions are provided:-
If the module name is
a-clibooster
, you can leave it blank -
If the group name is
default
,you can leave it blank
-
For examples:
Full Name | Short Name |
---|---|
a-clibooster:default:list | ::list |
a-clibooster:create:module | :create:module |
test-party:default:demo | test-party::demo |
- args
Whether and how many arguments can be followed after a command is determined by the specific command, for example:
- 1# install modules: test-flow, test-note
- 2$ npm run cli :store:sync test-flow test-note
- options
Whether and how many options can be followed after a command is determined by the specific command, for example:
- 1# create a module of test-suite1 for the suite of test-suite1
- 2$ npm run cli :create:module test-module1 -- --suite=test-suite1
- help
If we don’t know how to use a command, we can print out the help information directly, such as:
- 1$ npm run cli :create:module -- --help
- version
We can also print out the version number of a command, such as:
- 1$ npm run cli :create:module -- --version
- list commands
To query the commands supported by the current system, you can do the following:
- 1# list all commands
- 2$ npm run cli
- 3# list all commands
- 4$ npm run cli ::list
- 5# list the commands provided by the module of test-party
- 6$ npm run cli ::list -- --module=test-party
- 7# list the commands of create group provided by the module of a-clibooster
- 8$ npm run cli ::list -- --module=a-clibooster --group=create
Built-in commands
CabloyJS has provided a large number of built-in commands through the module of a-clibooster
, as follows:
Command | Description |
---|---|
::list | list all commands |
:token:add | add open auth token |
:token:delete | delete open auth token |
:token:list | list all open auth tokens |
:tools:babel | babel js files |
:tools:icons | handle icons modules |
:create:suite | create a new suite |
:create:module | create a new module |
:create:atom | create a new atom class |
:create:controller | create a new set of controller files(includes: Route, Controller, Service) |
:store:sync | install Suite/Module from Cabloy Store |
:store:publish | publish Suite/Module to Cabloy Store |
Shorten Commands
CabloyJS also provides more shorten commands. You can experience them yourself, which will significantly improve the development efficiency
- 1$ npm run cli
- 2$ npm run cli :
- 3$ npm run cli ::
- 4$ npm run cli :default:
- 5$ npm run cli :create:
- 6$ npm run cli test-party:
- 7$ npm run cli test-party::
- 8$ npm run cli test-party:default:
Comments: