rtolms-cli
Version:
CLI development tool for the Roundtable Learning Management System
446 lines (328 loc) • 11.9 kB
Markdown
rtolms-cli
==========
CLI development tool for the Roundtable Learning Management System
[](https://oclif.io)
[](https://npmjs.org/package/rtolms-cli)
[](https://ci.appveyor.com/project/RT-BuildBot/rtolms-cli/branch/master)
[](https://github.com/semantic-release/semantic-release)
---
<!-- toc -->
* [Requirements](#requirements)
* [Usage](#usage)
* [Commands](#commands)
* [Configuration with `.env` Files](#configuration-with-env-files)
<!-- tocstop -->
# Requirements
- `git` available in your path
- A [personal access token](https://github.com/settings/tokens) for authenticating to the GitHub API
- private key authentication configured for `git+ssh://` protocol access to GitHub
- Use `ssh-keygen` to create a key pair
- [Add your public key to your GitHub account](https://github.com/settings/keys)
# Usage
<!-- usage -->
```sh-session
$ npm install -g rtolms-cli
$ rtolms COMMAND
running command...
$ rtolms (-v|--version|version)
rtolms-cli/2.17.2 linux-x64 node-v8.12.0
$ rtolms --help [COMMAND]
USAGE
$ rtolms COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`rtolms autocomplete [SHELL]`](#rtolms-autocomplete-shell)
* [`rtolms clone`](#rtolms-clone)
* [`rtolms config`](#rtolms-config)
* [`rtolms config:init`](#rtolms-configinit)
* [`rtolms config:set KEY VALUE`](#rtolms-configset-key-value)
* [`rtolms get-path [CUSTOMERNAME]`](#rtolms-get-path-customername)
* [`rtolms git`](#rtolms-git)
* [`rtolms help [COMMAND]`](#rtolms-help-command)
* [`rtolms link [CUSTOMERNAME]`](#rtolms-link-customername)
* [`rtolms reconfigure`](#rtolms-reconfigure)
* [`rtolms sql:incrementals [CUSTOMERNAME]`](#rtolms-sqlincrementals-customername)
* [`rtolms status`](#rtolms-status)
* [`rtolms unlink`](#rtolms-unlink)
* [`rtolms which`](#rtolms-which)
## `rtolms autocomplete [SHELL]`
display autocomplete installation instructions
```
USAGE
$ rtolms autocomplete [SHELL]
ARGUMENTS
SHELL shell type
OPTIONS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
EXAMPLES
$ rtolms autocomplete
$ rtolms autocomplete bash
$ rtolms autocomplete zsh
$ rtolms autocomplete --refresh-cache
```
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.1.0/src/commands/autocomplete/index.ts)_
## `rtolms clone`
Updates local working copies
```
USAGE
$ rtolms clone
OPTIONS
-a, --auth-type=private-key|token [default: token] Which authentication type to use
-c, --concurrency=concurrency (required) [default: 4] Number of operations to run at once
-d, --dry-run Don't actually perform clone
-h, --help show CLI help
-v, --verbose Verbose
--force Do not stop on errors
EXAMPLE
$ rtolms clone
```
_See code: [src/commands/clone.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/clone.ts)_
## `rtolms config`
Create or modify configuration files
```
USAGE
$ rtolms config
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
ALIASES
$ rtolms config:list
$ rtolms config:index
```
_See code: [src/commands/config/index.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/config/index.ts)_
## `rtolms config:init`
Prompt for data to create the required configuration file
```
USAGE
$ rtolms config:init
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
ALIASES
$ rtolms init
```
_See code: [src/commands/config/init.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/config/init.ts)_
## `rtolms config:set KEY VALUE`
Set a configuration key's value
```
USAGE
$ rtolms config:set KEY VALUE
ARGUMENTS
KEY Config key to set
VALUE The value to set
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
ALIASES
$ rtolms set
$ rtolms config:set
```
_See code: [src/commands/config/set.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/config/set.ts)_
## `rtolms get-path [CUSTOMERNAME]`
Prints repo directory path for a given customer
```
USAGE
$ rtolms get-path [CUSTOMERNAME]
ARGUMENTS
CUSTOMERNAME Partial customer name (fuzzy matched to custom repo names)
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
ALIASES
$ rtolms path
EXAMPLES
$ rtolms get-path
$ rtolms get-path fed
```
_See code: [src/commands/get-path.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/get-path.ts)_
## `rtolms git`
Run any git operation on all customer repos
```
USAGE
$ rtolms git
OPTIONS
-c, --concurrency=concurrency (required) [default: 1] Number of operations to run at once
-h, --help show CLI help
-v, --verbose Verbose
--force Do not stop on errors
EXAMPLE
$ rtolms git fetch
```
_See code: [src/commands/git.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/git.ts)_
## `rtolms help [COMMAND]`
display help for rtolms
```
USAGE
$ rtolms help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.3/src/commands/help.ts)_
## `rtolms link [CUSTOMERNAME]`
Link a custom dir to lms-core
```
USAGE
$ rtolms link [CUSTOMERNAME]
ARGUMENTS
CUSTOMERNAME Partial customer name (fuzzy matched to custom repo names)
OPTIONS
-h, --help show CLI help
-j, --use-junction Use a junction symlink type on windows (defaults to "dir" type)
-t, --target=target Target path to link to
-v, --verbose Verbose
EXAMPLES
$ rtolms link
# prompts for user input to select a customer
$ rtolms link ama
# fuzzy matches customer
$ rtolms link --target=~/Projects/some/dir
# Overrides link target manually
```
_See code: [src/commands/link.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/link.ts)_
## `rtolms reconfigure`
Changes database connection strings
```
USAGE
$ rtolms reconfigure
OPTIONS
-R, --replace=replace Replace entire connection string with this value instead of the current value.
-d, --database=database The name of the database to change to. Defaults to `config.database`.
-h, --help show CLI help
-s, --server=server The database server name to change to. Defaults to `config.server`.
-v, --verbose Verbose
--no-strip-bom Do not remove the byte order mark from processed files
ALIASES
$ rtolms reconf
$ rtolms reconfig
$ rtolms setdb
$ rtolms set-db
$ rtolms changedb
EXAMPLES
$ rtolms reconfig
# Replaces *server* and *database* values in connection strings with those from your current configuration
This is useful for new databases with no auth info
$ rtolms reconfig -R "Server=willbereplaced;DataBase=willbereplaced;UID=dev;PWD=elopment;"
# Replaces entire connection string with this val (with *server* and *database* values replaced)
```
_See code: [src/commands/reconfigure.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/reconfigure.ts)_
## `rtolms sql:incrementals [CUSTOMERNAME]`
Run SQL incremental scripts
```
USAGE
$ rtolms sql:incrementals [CUSTOMERNAME]
ARGUMENTS
CUSTOMERNAME Partial customer name (fuzzy matched to custom repo names)
OPTIONS
-L, --no-use-linked
Ignore currently linked custom dir
-a, --archived
Show archived incrementals also
-c, --core
Run core incrementals instead of custom
-d, --database=database
The name of the database to change to. Defaults to `config.database`.
-h, --help
show CLI help
-p, --password=password
(required) [default: elopment] The password to connect to the db with.
-s, --server=server
The database server name to change to. Defaults to `config.server`.
-u, --username=username
[default: dev] The username to connect to the db with.
-v, --verbose
Verbose
--from=from
(required) [default: last 6 months] Preselect scripts dated after FROM. See
[parser](https://github.com/wanasit/chrono) for more info on matching.
--from="last 6 months"
--from="2 months ago"
--from="June"
--from="2018-03-01"
--from="last month"
--from="jan 1"
--instance=instance
The sql server instance on the server (Must have port 1434 open). Defaults to server.split(\)[1]
DESCRIPTION
This command will look for .sql scripts in subdirectories of the selected repo
named "Sql". If any are found, it will prompt you to select which scripts to
run before executing them.
The --from flag can be used to preselect scripts which are dated after
the given time. See examples for more.
ALIASES
$ rtolms sql
$ rtolms sql:index
EXAMPLES
$ rtolms sql:incrementals
# finds scripts in your currently linked custom dir
$ rtolms sql:incrementals -L
# prompts for a custom repo to look for scripts in
$ rtolms sql:incrementals --core --from="jul 4"
# finds scripts in your lms-core dir and preselects all dated after July 4 of this year
$ rtolms sql:incrementals ama
# finds scripts in fuzzy matched lms-custom-aama dir
$ rtolms sql:incrementals -s="my-vm.local"
# connects to server on "my-vm.local" (port 1433)
$ rtolms sql:incrementals -s="my-vm.local\\SQLEXPRESS"
# connects to server instance "SQLEXPRESS" on "my-vm.local"
$ rtolms sql:incrementals -ca
# runs archived incrementals from core
```
_See code: [src/commands/sql/incrementals.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/sql/incrementals.ts)_
## `rtolms status`
Shows status of all repos
```
USAGE
$ rtolms status
OPTIONS
-c, --concurrency=concurrency (required) [default: 4] Number of operations to run at once
-f, --fetch Fetch from remote before checking status
-h, --help show CLI help
-v, --verbose Verbose
--force Do not stop on errors
ALIASES
$ rtolms st
$ rtolms stat
```
_See code: [src/commands/status.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/status.ts)_
## `rtolms unlink`
Unlink a custom dir to lms-core
```
USAGE
$ rtolms unlink
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
```
_See code: [src/commands/unlink.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/unlink.ts)_
## `rtolms which`
Prints which customer is currently linked
```
USAGE
$ rtolms which
OPTIONS
-h, --help show CLI help
-v, --verbose Verbose
```
_See code: [src/commands/which.ts](https://github.com/roundtablelearning/rtolms-cli/blob/v2.17.2/src/commands/which.ts)_
<!-- commandsstop -->
---
# Configuration with `.env` Files
As of v2.17.0, the cli will read database and server from `.env` or `.env.defaults` files in the root of the currently linked custom dir.
For example, if we have this fs structure:
```sh
├── lms
│ ├── lms-core
│ ├── lms-custom-enviva #<-- linked
│ │ └── .env.defaults
│ ├── lms-custom-plygem
│ └── lms-custom-tcx
│ ├── .env
│ └── .env.defaults
```
When running any command, the CLI will read the `database` value from `lms/lms-custom-enviva/.env.defaults`.
See https://github.com/mrsteele/dotenv-defaults#readme for more.