diff --git a/docs/commands.md b/docs/commands.md index 24588bbb..542cf19d 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -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` @@ -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` diff --git a/lib/command/run.rb b/lib/command/run.rb index a9332186..f2833c49 100644 --- a/lib/command/run.rb +++ b/lib/command/run.rb @@ -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 diff --git a/lib/command/run_detached.rb b/lib/command/run_detached.rb index 2bed8da2..1966354c 100644 --- a/lib/command/run_detached.rb +++ b/lib/command/run_detached.rb @@ -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