Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelgomesxyz committed Feb 9, 2024
1 parent 99647b0 commit 714848f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
28 changes: 11 additions & 17 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,28 +332,25 @@ cpl ps:swait -a $APP_NAME -w $WORKLOAD_NAME
cpl run -a $APP_NAME
# Need to quote COMMAND if setting ENV value or passing args.
cpl run 'LOG_LEVEL=warn rails db:migrate' -a $APP_NAME
# COMMAND may also be passed at the end.
cpl run -a $APP_NAME -- 'LOG_LEVEL=warn rails db:migrate'
# Runs command, displays output, and exits shell.
cpl run ls / -a $APP_NAME
cpl run rails db:migrate:status -a $APP_NAME
cpl run -a $APP_NAME -- ls /
cpl run -a $APP_NAME -- rails db:migrate:status
# Runs command and keeps shell open.
cpl run rails c -a $APP_NAME
cpl run -a $APP_NAME -- rails c
# Uses a different image (which may not be promoted yet).
cpl run rails db:migrate -a $APP_NAME --image appimage:123 # Exact image name
cpl run rails db:migrate -a $APP_NAME --image latest # Latest sequential image
cpl run -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
cpl run -a $APP_NAME --image latest -- rails db:migrate # Latest sequential image
# Uses a different workload than `one_off_workload` from `.controlplane/controlplane.yml`.
cpl run bash -a $APP_NAME -w other-workload
cpl run -a $APP_NAME -w other-workload -- bash
# Overrides remote CPLN_TOKEN env variable with local token.
# Useful when superuser rights are needed in remote container.
cpl run bash -a $APP_NAME --use-local-token
cpl run -a $APP_NAME --use-local-token -- bash
```
### `run:cleanup`
Expand Down Expand Up @@ -383,21 +380,18 @@ cpl run:cleanup -a $APP_NAME
cpl run:detached rails db:prepare -a $APP_NAME
# Need to quote COMMAND if setting ENV value or passing args.
cpl run:detached 'LOG_LEVEL=warn rails db:migrate' -a $APP_NAME
# COMMAND may also be passed at the end.
cpl run:detached -a $APP_NAME -- 'LOG_LEVEL=warn rails db:migrate'
# Uses a different image (which may not be promoted yet).
cpl run:detached rails db:migrate -a $APP_NAME --image appimage:123 # Exact image name
cpl run:detached rails db:migrate -a $APP_NAME --image latest # Latest sequential image
cpl run:detached -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
cpl run:detached -a $APP_NAME --image latest -- rails db:migrate # Latest sequential image
# Uses a different workload than `one_off_workload` from `.controlplane/controlplane.yml`.
cpl run:detached rails db:migrate:status -a $APP_NAME -w other-workload
cpl run:detached -a $APP_NAME -w other-workload -- rails db:migrate:status
# Overrides remote CPLN_TOKEN env variable with local token.
# Useful when superuser rights are needed in remote container.
cpl run:detached rails db:migrate:status -a $APP_NAME --use-local-token
cpl run:detached -a $APP_NAME --use-local-token -- rails db:migrate:status
```
### `setup-app`
Expand Down
17 changes: 7 additions & 10 deletions lib/command/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,25 @@ class Run < Base
cpl run -a $APP_NAME
# Need to quote COMMAND if setting ENV value or passing args.
cpl run 'LOG_LEVEL=warn rails db:migrate' -a $APP_NAME
# COMMAND may also be passed at the end.
cpl run -a $APP_NAME -- 'LOG_LEVEL=warn rails db:migrate'
# Runs command, displays output, and exits shell.
cpl run ls / -a $APP_NAME
cpl run rails db:migrate:status -a $APP_NAME
cpl run -a $APP_NAME -- ls /
cpl run -a $APP_NAME -- rails db:migrate:status
# Runs command and keeps shell open.
cpl run rails c -a $APP_NAME
cpl run -a $APP_NAME -- rails c
# Uses a different image (which may not be promoted yet).
cpl run rails db:migrate -a $APP_NAME --image appimage:123 # Exact image name
cpl run rails db:migrate -a $APP_NAME --image latest # Latest sequential image
cpl run -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
cpl run -a $APP_NAME --image latest -- rails db:migrate # Latest sequential image
# Uses a different workload than `one_off_workload` from `.controlplane/controlplane.yml`.
cpl run bash -a $APP_NAME -w other-workload
cpl run -a $APP_NAME -w other-workload -- bash
# Overrides remote CPLN_TOKEN env variable with local token.
# Useful when superuser rights are needed in remote container.
cpl run bash -a $APP_NAME --use-local-token
cpl run -a $APP_NAME --use-local-token -- bash
```
EX

Expand Down
11 changes: 4 additions & 7 deletions lib/command/run_detached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@ class RunDetached < Base # rubocop:disable Metrics/ClassLength
cpl run:detached rails db:prepare -a $APP_NAME
# Need to quote COMMAND if setting ENV value or passing args.
cpl run:detached 'LOG_LEVEL=warn rails db:migrate' -a $APP_NAME
# COMMAND may also be passed at the end.
cpl run:detached -a $APP_NAME -- 'LOG_LEVEL=warn rails db:migrate'
# Uses a different image (which may not be promoted yet).
cpl run:detached rails db:migrate -a $APP_NAME --image appimage:123 # Exact image name
cpl run:detached rails db:migrate -a $APP_NAME --image latest # Latest sequential image
cpl run:detached -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
cpl run:detached -a $APP_NAME --image latest -- rails db:migrate # Latest sequential image
# Uses a different workload than `one_off_workload` from `.controlplane/controlplane.yml`.
cpl run:detached rails db:migrate:status -a $APP_NAME -w other-workload
cpl run:detached -a $APP_NAME -w other-workload -- rails db:migrate:status
# Overrides remote CPLN_TOKEN env variable with local token.
# Useful when superuser rights are needed in remote container.
cpl run:detached rails db:migrate:status -a $APP_NAME --use-local-token
cpl run:detached -a $APP_NAME --use-local-token -- rails db:migrate:status
```
EX

Expand Down

0 comments on commit 714848f

Please sign in to comment.