Skip to content

Add -e flag for non-interactive command execution - #407

Merged
em3s merged 6 commits into
mainfrom
feat/non-interactive-mode
Jul 10, 2026
Merged

em3s merged 6 commits into
mainfrom
feat/non-interactive-mode

Conversation

@em3s

@em3s em3s commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds -e flag and env var defaults so the CLI can be used non-interactively — analogous to mysql -e.

Changes

  • cli/cmd/actionbase/main.go: -e "command" runs the command without entering the REPL, enables plain mode, exits 1 on failure; ACT_HOST / ACT_API_KEY env vars as defaults for --host / --authKey
  • cli/internal/util/print.go: adds IsPlainMode() accessor
  • cli/internal/runner/actionbase_runner.go: suppresses timing output in plain mode

How to Test

export ACT_HOST=http://localhost:8080

actionbase -e "show databases"
actionbase -e "show databases" | grep my_db
actionbase --host http://other -e "show databases"

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Sonnet 4.6

Supports `actionbase -e "show databases"` to run any REPL command
without entering the interactive loop — analogous to `mysql -e`.
Automatically enables plain mode (no prefix, no timing output) and
exits 1 on failure.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Jul 10, 2026
em3s and others added 2 commits July 10, 2026 11:43
… flags

ParseArgs only handles --key prefixed flags; single-dash -e caused
--authKey to consume the rest of the args as its value.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
ParseArgs only handles --key flags, so -e was parsed as part of
--authKey's value. Extract -e from os.Args before ParseArgs runs.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 10, 2026
em3s and others added 3 commits July 10, 2026 11:56
--host and --authKey flags override the env vars.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…--host)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@em3s

em3s commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Optimistic merge.

@em3s
em3s merged commit e4a1008 into main Jul 10, 2026
2 checks passed
@em3s
em3s deleted the feat/non-interactive-mode branch July 10, 2026 03:59
@em3s em3s self-assigned this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant