Skip to content

feat: add -print flag to print the suggested command and exit - #18

Merged
Thakay merged 1 commit into
Thakay:mainfrom
cestercian:feat/print-flag
Oct 5, 2026
Merged

Thakay merged 1 commit into
Thakay:mainfrom
cestercian:feat/print-flag

Conversation

@cestercian

Copy link
Copy Markdown
Contributor

Summary

Adds -print, which writes just the suggested command to stdout and exits. No menu, nothing runs, and stdin is never read. The cases that would normally prompt (missing key, rejected key, a reply that is not a command, a reply with hidden characters) return an error instead, so they exit 1 with the message on stderr.

Docs are updated in -h, the README (with a note that piping into a shell skips confirmation), the man page and the bash/zsh/fish completions.

Related issue

Closes #14

Type of change

  • Bug fix (fixes a problem without changing intended behavior)
  • New feature (adds functionality without breaking existing usage)
  • Breaking change (changes existing flags, environment variables, output or exit codes)
  • Documentation only
  • Tests, CI, build or refactoring (no user facing change)

Checklist

  • I added or updated tests for this change.
  • make test and make lint pass locally.
  • I added an entry under ## [Unreleased] in CHANGELOG.md for user facing changes.
  • I updated the docs (README.md, aiterm -h help text) where needed.
  • My commits and the pull request title follow Conventional Commits.

Tests use chatServer with a stdin reader that fails the test if it gets read, plus two new -print cases in TestMainExitCodes.

@Thakay
Thakay merged commit 4104450 into Thakay:main Oct 5, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a -print flag that prints the suggested command and exits

2 participants