A CliW[rapper] to ease day to day command line tasks!
$ npm install -g cliw
$ cliw COMMAND
running command...
$ cliw (-v|--version|version)
cliw/0.0.0 darwin-x64 node-v10.12.0
$ cliw --help [COMMAND]
USAGE
$ cliw COMMAND
...
The init
sub command is used to create the initial projects.yaml
file. cliw
supports the management of several
services and databases under a project context. By doing so multiple cliw
project configurations can be maintained
at the same time while cliw
supports switching between those when needed. This functionality comes in very handy
when work has to be done for several clients or to keep private and business projects separated.
The default location of the projects.yaml
file is $HOME/.config/cliw
and can be overwritten via an environment
variable CLIW_CONFIG_PATH
.
The init
sub command also requires two parameters to finish its work:
-
The location (absolute path) of the so called working directory.
cliw
uses this location to be able to utilize theservice
sub command which is used to manage service containers (e.g.: start, stop, exec ...). -
The location of the configuration files. To properly work
cliw
expects the existence of the following files:docker-compose.yaml
service-metadata.yaml
service-parameters.yaml
service-overrides.yaml
(optional ascliw
will use fallback strategy)data-sources.yaml
Examples for each of those configuration files can be found here.
Once the init
command was used to setup the first project the project
command can be used to add new projects
and switch between them when needed.
The db
command is a wrapper for several database command line tools e.g. psql
, pg_dump
pg_restore
to expose those via a streamlined simplified interface. Furthermore, it is using one centralized
configuration file (data-sources.yaml
) to be able to connect to different data sources incl. support of data sources
which can only be accessed via SSH TUNNEL
. To remove the pain of installing all those tools locally official docker
images are used.
Currently Postgres
and MySQL
are supported.
The secret
command is a wrapper of the AWS KMS SDK to encrypt or decrypt string
tokens e.g. passwords.
The service
command is a wrapper of docker-compose
. The benefit of using this wrapper is that you can easily manage
e.g. start, stop services in different environments defined using one centralized configuration. The switch between
running a service container from an image of a registry or build the image from source is supported via cliw
commands
directly. No change of configuration files is necessary.
cliw db:console DATASOURCE
cliw db:create DATASOURCE
cliw db:drop DATASOURCE
cliw db:dump DATASOURCE
cliw db:restore DATASOURCE
cliw help [COMMAND]
cliw init
cliw project:add PROJECT
cliw project:list
cliw project:remove PROJECT
cliw project:set-default PROJECT
cliw secret:decrypt
cliw secret:encrypt
cliw service:checkout [SERVICES]
cliw service:config [SERVICES]
cliw service:exec SERVICE COMMAND
cliw service:image:list [SERVICES]
cliw service:image:pull [SERVICES]
cliw service:image:set-origin SERVICE ORIGIN
cliw service:list
cliw service:logs [SERVICES]
cliw service:run SERVICE COMMAND
cliw service:start [SERVICES]
cliw service:status [SERVICES]
cliw service:stop [SERVICES]
run database console
USAGE
$ cliw db:console DATASOURCE
ARGUMENTS
DATASOURCE (api) data source specified by name
OPTIONS
-c, --command=command run only single command (SQL or internal) and exit
-e, --environment=development|test (required) [default: development]
-f, --file=file execute commands from file, then exit
-h, --help show CLI help
--dry-run print shell commands without executing
See code: src/commands/db/console.ts
create database
USAGE
$ cliw db:create DATASOURCE
ARGUMENTS
DATASOURCE (api) data source specified by name
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run print shell commands without executing
See code: src/commands/db/create.ts
create database
USAGE
$ cliw db:drop DATASOURCE
ARGUMENTS
DATASOURCE (api) data source specified by name
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run print shell commands without executing
See code: src/commands/db/drop.ts
create database
USAGE
$ cliw db:dump DATASOURCE
ARGUMENTS
DATASOURCE (api) data source specified by name
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
-o, --schema-only dump schema without data
-t, --target=target (required) dump file location (relative to current directory)
--dry-run print shell commands without executing
See code: src/commands/db/dump.ts
restore database
USAGE
$ cliw db:restore DATASOURCE
ARGUMENTS
DATASOURCE (api) data source specified by name
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
-r, --restore-file=restore-file (required) restore file location (relative to current directory)
--dry-run print shell commands without executing
See code: src/commands/db/restore.ts
display help for cliw
USAGE
$ cliw help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
Create and setup default project and configuration.
USAGE
$ cliw init
OPTIONS
-c, --config-directory=config-directory absolute location of the configuration directory
-h, --help show CLI help
-n, --name=name project unique identifier (name)
-w, --working-directory=working-directory absolute location of the working directory
DESCRIPTION
[cliw] supports the 'orchestration' of multiple projects.
Therefore it needs to maintain the path to the configuration directory
(location of e.g. service-metadata.yaml, service-runtime.yaml
service-parameters.yaml, docker-compose.yaml and db-parameters) and the
working directory. The latter is e.g. used as checkout path of the defined
services.
Called without options the 'init' command is executed in interactive mode
to gather the information needed directly from the prompt.
Data in stored in projects-config.json at: ~/.config/ (default).
See code: src/commands/init.ts
add project
USAGE
$ cliw project:add PROJECT
ARGUMENTS
PROJECT project specified by name
OPTIONS
-c, --config=config (required) absolute path to the configuration files directory
-h, --help show CLI help
-w, --working-directory=working-directory (required) absolute path to the working directory
See code: src/commands/project/add.ts
list projects
USAGE
$ cliw project:list
OPTIONS
-x, --extended show extra columns
--columns=columns only show provided columns (comma-separated)
--csv output is csv format [alias: --output=csv]
--filter=filter filter property by partial string matching, ex: name=foo
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=csv|json|yaml output in a more machine friendly format
--sort=sort property to sort by (prepend '-' for descending)
See code: src/commands/project/list.ts
remove project
USAGE
$ cliw project:remove PROJECT
ARGUMENTS
PROJECT project specified by name
OPTIONS
-h, --help show CLI help
See code: src/commands/project/remove.ts
set default project
USAGE
$ cliw project:set-default PROJECT
ARGUMENTS
PROJECT project specified by name
OPTIONS
-h, --help show CLI help
See code: src/commands/project/set-default.ts
decrypt secret encrypted via AWS KMS
USAGE
$ cliw secret:decrypt
OPTIONS
-h, --help show CLI help
-s, --secret=secret (required) Secret to decrypt
See code: src/commands/secret/decrypt.ts
encrypt value via AWS KMS
USAGE
$ cliw secret:encrypt
OPTIONS
-h, --help show CLI help
-k, --keyId=keyId (required) AWS KMS customer master key id
-v, --value=value (required) Value to encrypt
See code: src/commands/secret/encrypt.ts
Checkout service(s) from version control.
USAGE
$ cliw service:checkout [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
-s, --services=services
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/checkout.ts
List, set or validate service(s) configuration.
USAGE
$ cliw service:config [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help Show CLI help.
-i, --image-origin=source|registry Set service(s) image origin.
--list List service(s) configuration.
--validate Validate service(s) configuration.
See code: src/commands/service/config.ts
Execute a command in a running service container.
USAGE
$ cliw service:exec SERVICE COMMAND
ARGUMENTS
SERVICE (api|db) service name
COMMAND specify command to execute
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run Print command(s) to STDOUT without actually executing.
--no-tty Disable pseudo-tty allocation.
See code: src/commands/service/exec.ts
List service(s) origin SOURCE|REGISTRY
USAGE
$ cliw service:image:list [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
See code: src/commands/service/image/list.ts
Pull container image(s) from registry
USAGE
$ cliw service:image:pull [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/image/pull.ts
Set containers image origin (source|registry)
USAGE
$ cliw service:image:set-origin SERVICE ORIGIN
ARGUMENTS
SERVICE (api|db) service name
ORIGIN (registry|source) origin of the container image
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/image/set-origin.ts
List service(s) metadata.
USAGE
$ cliw service:list
OPTIONS
-h, --help show CLI help
-x, --extended show extra columns
--columns=columns only show provided columns (comma-separated)
--csv output is csv format [alias: --output=csv]
--filter=filter filter property by partial string matching, ex: name=foo
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=csv|json|yaml output in a more machine friendly format
--sort=sort property to sort by (prepend '-' for descending)
See code: src/commands/service/list.ts
Show service(s) logs.
USAGE
$ cliw service:logs [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-f, --follow follow log output
-h, --help show CLI help
-t, --timestamps show timestamps
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/logs.ts
Run a one-off command on a service.
USAGE
$ cliw service:run SERVICE COMMAND
ARGUMENTS
SERVICE (api|db) service name
COMMAND specify command to execute
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--dry-run Print command(s) to STDOUT without actually executing.
--entrypoint=entrypoint Override the entrypoint of the image.
--no--tty Disable pseudo-tty allocation.
See code: src/commands/service/run.ts
Start service(s) in daemon mode.
USAGE
$ cliw service:start [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
--[no-]build Build images before starting containers.
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/start.ts
Show service(s) run status.
USAGE
$ cliw service:status [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
-s, --services=services
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/status.ts
Stop running service(s).
USAGE
$ cliw service:stop [SERVICES]
ARGUMENTS
SERVICES (api|db) Service name(s) defined in docker-compose.yaml [default: ALL...].
OPTIONS
-e, --environment=development|test (required) [default: development]
-h, --help show CLI help
-t, --timeout=timeout [default: 10] Specify a shutdown timeout in seconds.
--dry-run Print command(s) to STDOUT without actually executing.
See code: src/commands/service/stop.ts