feat: add text input support#24
Merged
Merged
Conversation
Add -t/--text option to generate and image commands as alternative to --input file. Enables: - Quick one-off generations without temp files - Long multi-line prompts via shell quoting - Template variables work with text input Changes: - Add --text option to GenerateArgs and ImageArgs - Validate mutually exclusive --input/--text (one required) - Update generate_output_filename to handle no input file - Add comprehensive documentation in help --full - Add specs/text-input.md specification - Add test_cases/text_input.md smoke tests - Add unit tests for CLI parsing with --text
Simplify input handling by using single --input option that auto-detects: - If value exists as file path: reads from file - Otherwise: uses value as direct prompt text Removes separate --text option in favor of unified approach. Updates specs, test cases, help documentation, and unit tests.
Input can now be provided as positional arg or -i flag: trickery generate "Write a haiku" trickery generate -i "Write a haiku" Both work identically with auto-detection of file vs text. Updates help, specs, test cases, and unit tests.
- Add value_name="INPUT" to show [INPUT] instead of [INPUT_POSITIONAL] - Add override_usage to show [INPUT] before [OPTIONS] in usage line
Replace -i flag with positional argument syntax throughout: - README.md and prompts/trickery_readme.md - docs/images.md and docs/image-generation.md - specs/text-input.md - All test case files - src/main.rs help examples Positional is now the preferred syntax, with -i kept for backwards compatibility only.
3da77ea to
e286011
Compare
chaliy
added a commit
that referenced
this pull request
May 30, 2026
## What Add support for direct text input to `generate` and `image` commands without requiring a file. Input can now be provided as: - Positional argument: `trickery generate "Your prompt here"` - Flag argument: `trickery generate -i "Your prompt here"` - File path (existing behavior): `trickery generate prompt.txt` The input is auto-detected: if the value is an existing file path, it reads the file; otherwise, it treats it as direct text. ## Why Users often want to run quick one-off prompts without creating temporary files. This is especially useful in CI/CD pipelines and shell scripts where inline prompts are more convenient. ## How - Added `resolve_input()` function that checks if input path exists (reads file) or not (uses as text) - Implemented dual input capture with positional and `-i` flag arguments - Updated `generate_output_filename()` to handle text input (defaults to "image" stem) - Added `override_usage` for cleaner help display showing `[INPUT] [OPTIONS]` ## Risk - Low - Existing file-based workflows unchanged; auto-detection only falls back to text if path doesn't exist ### Checklist - [x] Unit tests are passed - [x] Smoke tests are passed - [x] Documentation is updated (specs/text-input.md, test_cases/text_input.md) --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add support for direct text input to
generateandimagecommands without requiring a file. Input can now be provided as:trickery generate "Your prompt here"trickery generate -i "Your prompt here"trickery generate prompt.txtThe input is auto-detected: if the value is an existing file path, it reads the file; otherwise, it treats it as direct text.
Why
Users often want to run quick one-off prompts without creating temporary files. This is especially useful in CI/CD pipelines and shell scripts where inline prompts are more convenient.
How
resolve_input()function that checks if input path exists (reads file) or not (uses as text)-iflag argumentsgenerate_output_filename()to handle text input (defaults to "image" stem)override_usagefor cleaner help display showing[INPUT] [OPTIONS]Risk
Checklist