Skip to content

Commit e286011

Browse files
committed
docs: use positional syntax in all examples
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.
1 parent b4ce527 commit e286011

13 files changed

Lines changed: 99 additions & 116 deletions

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Idea is simple, imagine you need to generate some docs using LLM as part of CI,
88

99
> [!TIP]
1010
> This README was generated with trickery
11-
> trickery generate -i ./prompts/trickery_readme.md > README.md
11+
> trickery generate ./prompts/trickery_readme.md > README.md
1212
1313

1414
## Demo
@@ -28,7 +28,17 @@ trickery --help
2828

2929
```sh
3030
export OPENAI_API_KEY=s....d
31-
trickery generate -i ./prompts/trickery_readme.md > README.md
31+
trickery generate ./prompts/trickery_readme.md > README.md
32+
```
33+
34+
### Using with OpenAI-compatible gateways
35+
36+
You can use trickery with any OpenAI-compatible API gateway (like LiteLLM, Azure OpenAI, or local models) by setting the `OPENAI_BASE_URL` environment variable:
37+
38+
```sh
39+
export OPENAI_API_KEY=your-key
40+
export OPENAI_BASE_URL=http://localhost:4000/v1
41+
trickery generate ./prompts/my_prompt.md
3242
```
3343

3444
Input file could be any text file, with Jinja2-like template variables, like `{{"{{app_version}}"}}`. To set this variables, please use `-v` flag, like `-v app_version=1.0.0`.

docs/image-generation.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Trickery supports generating and editing images using OpenAI's Responses API wit
44

55
## CLI Arguments
66

7-
### `--input <PATH>` / `-i <PATH>`
7+
### `[INPUT]` (positional) or `-i <INPUT>`
88

9-
Path to the prompt template file. Supports Jinja2-style `{{ variable }}` substitution.
9+
Input prompt: file path or direct text (auto-detected). Supports Jinja2-style `{{ variable }}` substitution when using a file.
1010

1111
### `--save <PATH>` / `-s <PATH>` (optional)
1212

@@ -80,13 +80,13 @@ Template variables for prompt substitution.
8080

8181
```bash
8282
# Simple generation with explicit filename
83-
trickery image -i prompts/generate_diagram.md --save docs/images/colorful-architecture.png
83+
trickery image prompts/generate_diagram.md --save docs/images/colorful-architecture.png
8484

8585
# Auto-generated filename (e.g., generate_diagram-a3f5x.png)
86-
trickery image -i prompts/generate_diagram.md
86+
trickery image prompts/generate_diagram.md
8787

8888
# With quality settings
89-
trickery image -i prompts/generate_diagram.md -s architecture.png \
89+
trickery image prompts/generate_diagram.md -s architecture.png \
9090
--size 1536x1024 \
9191
--quality high
9292
```
@@ -101,12 +101,12 @@ See [prompts/generate_diagram.md](../prompts/generate_diagram.md) for the prompt
101101

102102
```bash
103103
# Make an image look realistic
104-
trickery image -i prompts/make_realistic.md \
104+
trickery image prompts/make_realistic.md \
105105
--image test_data/example_images/image1.png \
106106
--save output.png
107107

108108
# Edit with custom instruction
109-
trickery image -i prompts/edit_image.md \
109+
trickery image prompts/edit_image.md \
110110
--image test_data/example_images/image2.png \
111111
--save modified.png \
112112
-v instruction="make it green on pink"
@@ -117,7 +117,7 @@ See [prompts/make_realistic.md](../prompts/make_realistic.md) and [prompts/edit_
117117
### Highlight Areas in Image
118118

119119
```bash
120-
trickery image -i prompts/highlight_humans.md \
120+
trickery image prompts/highlight_humans.md \
121121
--image test_data/example_images/image3.jpg \
122122
--save highlighted.png
123123
```
@@ -127,7 +127,7 @@ See [prompts/highlight_humans.md](../prompts/highlight_humans.md) for the prompt
127127
### With Template Variables
128128

129129
```bash
130-
trickery image -i prompts/generate_icon.md \
130+
trickery image prompts/generate_icon.md \
131131
--save icon.png \
132132
-v subject="rocket" \
133133
-v style="flat design"
@@ -139,7 +139,7 @@ See [prompts/generate_icon.md](../prompts/generate_icon.md) for the prompt templ
139139

140140
```bash
141141
# Combine elements from multiple images
142-
trickery image -i prompts/edit_image.md \
142+
trickery image prompts/edit_image.md \
143143
--image test_data/example_images/image1.png \
144144
--image test_data/example_images/image2.png \
145145
--save composite.png \
@@ -149,7 +149,7 @@ trickery image -i prompts/edit_image.md \
149149
### Transparent Background
150150

151151
```bash
152-
trickery image -i prompts/generate_icon.md \
152+
trickery image prompts/generate_icon.md \
153153
--save logo.png \
154154
--background transparent \
155155
--format png \
@@ -160,7 +160,7 @@ trickery image -i prompts/generate_icon.md \
160160
### JSON Output
161161

162162
```bash
163-
trickery image -i prompts/generate_diagram.md --save result.png -o json
163+
trickery image prompts/generate_diagram.md --save result.png -o json
164164
```
165165

166166
Output:

docs/input-images.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Unknown extensions default to PNG MIME type.
3434
### Single Local Image
3535

3636
```bash
37-
trickery generate -i prompts/describe_image.md --image test_data/example_images/image2.png
37+
trickery generate prompts/describe_image.md --image test_data/example_images/image2.png
3838
```
3939

4040
Where `prompts/describe_image.md` contains:
@@ -45,13 +45,13 @@ Describe what you see in this image in detail.
4545
### Image from URL
4646

4747
```bash
48-
trickery generate -i prompts/describe_image.md --image https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
48+
trickery generate prompts/describe_image.md --image https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
4949
```
5050

5151
### Multiple Images
5252

5353
```bash
54-
trickery generate -i prompts/catalog_images.md \
54+
trickery generate prompts/catalog_images.md \
5555
--image test_data/example_images/image1.png \
5656
--image test_data/example_images/image2.png \
5757
--image test_data/example_images/image3.jpg
@@ -61,13 +61,13 @@ trickery generate -i prompts/catalog_images.md \
6161

6262
```bash
6363
# Low detail for quick classification
64-
trickery generate -i prompts/describe_image.md --image test_data/example_images/image1.png --image-detail low
64+
trickery generate prompts/describe_image.md --image test_data/example_images/image1.png --image-detail low
6565
```
6666

6767
### Combined with Variables
6868

6969
```bash
70-
trickery generate -i prompts/review_ui.md \
70+
trickery generate prompts/review_ui.md \
7171
--image test_data/example_images/image2.png \
7272
--var focus="accessibility" \
7373
--var format="bullet points"
@@ -100,7 +100,7 @@ Image support requires a vision-capable model. Recommended models:
100100

101101
Example with explicit model:
102102
```bash
103-
trickery generate -i prompts/describe_image.md --image test_data/example_images/image1.png --model gpt-5.2
103+
trickery generate prompts/describe_image.md --image test_data/example_images/image1.png --model gpt-5.2
104104
```
105105

106106
## Token Considerations

prompts/trickery_readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Idea is simple, imagine you need to generate some docs using LLM as part of CI,
1919

2020
> [!TIP]
2121
> This README was generated with trickery
22-
> trickery generate -i ./prompts/trickery_readme.md > README.md
22+
> trickery generate ./prompts/trickery_readme.md > README.md
2323
2424

2525
## Demo
@@ -39,7 +39,7 @@ trickery --help
3939

4040
```sh
4141
export OPENAI_API_KEY=s....d
42-
trickery generate -i ./prompts/trickery_readme.md > README.md
42+
trickery generate ./prompts/trickery_readme.md > README.md
4343
```
4444

4545
Input file could be any text file, with Jinja2-like template variables, like `{{"{{app_version}}"}}`. To set this variables, please use `-v` flag, like `-v app_version=1.0.0`.

specs/text-input.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
## Abstract
44

5-
Trickery's input supports both file paths and direct text, with auto-detection. If the provided value exists as a file, it reads from the file; otherwise, it treats the value as direct prompt text. Input can be provided as a positional argument or with the `-i` flag.
5+
Trickery's input supports both file paths and direct text, with auto-detection. If the provided value exists as a file, it reads from the file; otherwise, it treats the value as direct prompt text. Input is typically provided as a positional argument.
66

77
## Requirements
88

99
### Input Methods
1010

11-
Two equivalent ways to provide input:
12-
1. **Positional argument**: `trickery generate "prompt text"`
13-
2. **Named option**: `trickery generate -i "prompt text"`
11+
Input is provided as a positional argument:
1412

15-
Both work identically. Positional is preferred for brevity.
13+
```bash
14+
trickery generate "prompt text"
15+
trickery generate prompts/greeting.md
16+
```
17+
18+
The `-i` flag is also supported for backwards compatibility but positional is preferred.
1619

1720
### Input Auto-Detection
1821

@@ -26,19 +29,17 @@ Once input is provided (either way), this logic applies:
2629
```bash
2730
# File input (file exists, content read from file)
2831
trickery generate prompts/greeting.md
29-
trickery generate -i prompts/greeting.md
3032

3133
# Text input (not a file, used as direct prompt)
3234
trickery generate "Write a haiku"
33-
trickery generate -i "Write a haiku"
3435
```
3536

3637
- Template variables work with both: `--var name=Alice`
3738
- For `image` command, output filename defaults to `image-xxxxx.png` when input is text
3839

3940
### Long Text Support
4041

41-
Both positional and `-i` support:
42+
Positional input supports:
4243

4344
- Multi-line strings (using shell quoting)
4445
- Special characters and Unicode
@@ -67,11 +68,10 @@ EOF
6768

6869
## Design Choices
6970

70-
### Why support both positional and -i?
71+
### Why keep -i as fallback?
7172

72-
1. Positional is more natural for quick one-liners
73-
2. `-i` flag maintains backwards compatibility
74-
3. `-i` is clearer when input looks like a flag (edge case)
73+
1. Backwards compatibility with older scripts
74+
2. Useful when input looks like a flag (edge case)
7575

7676
### Why auto-detect instead of separate options?
7777

src/main.rs

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,12 @@ the given path, it reads from the file; otherwise treats input as direct text.
152152
153153
**Usage:**
154154
```bash
155-
trickery generate [INPUT] # positional argument
156-
trickery generate -i <INPUT> # or use -i flag
155+
trickery generate [INPUT] [OPTIONS]
157156
```
158157
159158
**Options:**
160-
- `<INPUT>`: Prompt input as positional arg - file path or direct text (auto-detected)
161-
- `-i, --input <INPUT>`: Same as positional, alternative syntax
159+
- `[INPUT]`: Prompt input - file path or direct text (auto-detected)
160+
- `-i, --input <INPUT>`: Alternative to positional (for backwards compatibility)
162161
- `-v, --var <KEY=VALUE>`: Variables to be used in prompt (can be repeated)
163162
- `-m, --model <MODEL>`: Model to use (e.g., gpt-5.2, gpt-5-mini, o1, o3-mini)
164163
- `-r, --reasoning <LEVEL>`: Reasoning level for o1/o3 models: low, medium, high
@@ -169,18 +168,12 @@ trickery generate -i <INPUT> # or use -i flag
169168
**Examples:**
170169
171170
```bash
172-
# From a prompt file (positional)
171+
# From a prompt file
173172
trickery generate prompts/greeting.md
174173
175-
# From a prompt file (with -i flag)
176-
trickery generate -i prompts/greeting.md
177-
178-
# Direct text input (positional)
174+
# Direct text input
179175
trickery generate "Write a haiku about programming"
180176
181-
# Direct text input (with -i flag)
182-
trickery generate -i "Write a haiku about programming"
183-
184177
# Long text with shell quoting
185178
trickery generate "You are a helpful assistant.
186179
@@ -211,13 +204,12 @@ at the given path, it reads from the file; otherwise treats input as direct text
211204
212205
**Usage:**
213206
```bash
214-
trickery image [INPUT] # positional argument
215-
trickery image -i <INPUT> # or use -i flag
207+
trickery image [INPUT] [OPTIONS]
216208
```
217209
218210
**Options:**
219-
- `<INPUT>`: Prompt input as positional arg - file path or direct text (auto-detected)
220-
- `-i, --input <INPUT>`: Same as positional, alternative syntax
211+
- `[INPUT]`: Prompt input - file path or direct text (auto-detected)
212+
- `-i, --input <INPUT>`: Alternative to positional (for backwards compatibility)
221213
- `-s, --save <FILE>`: Output file path (auto-generated if not provided)
222214
- `-v, --var <KEY=VALUE>`: Variables to be used in prompt (can be repeated)
223215
- `-m, --model <MODEL>`: Model to use (e.g., gpt-4.1, gpt-5, gpt-5.2)
@@ -232,15 +224,12 @@ trickery image -i <INPUT> # or use -i flag
232224
**Examples:**
233225
234226
```bash
235-
# From a prompt file (positional)
227+
# From a prompt file
236228
trickery image prompts/logo.md
237229
238-
# Direct text input (positional)
230+
# Direct text input
239231
trickery image "A cute cartoon cat sitting on a rainbow"
240232
241-
# With -i flag
242-
trickery image -i prompts/logo.md
243-
244233
# Long descriptive prompt
245234
trickery image "A professional logo for a tech startup called 'CloudSync'.
246235
Modern, minimalist design with blue and white colors."
@@ -300,7 +289,7 @@ Keep it concise and friendly.
300289
301290
**Usage:**
302291
```bash
303-
trickery generate -i prompts/email.md --var name="Alice" --var topic="quarterly review"
292+
trickery generate prompts/email.md --var name="Alice" --var topic="quarterly review"
304293
```
305294
306295
## Exit Codes
@@ -376,8 +365,8 @@ mod tests {
376365
fn test_full_help_contains_examples() {
377366
let full_help = include_str!("main.rs");
378367
// Verify examples are present
379-
assert!(full_help.contains("trickery generate -i"));
380-
assert!(full_help.contains("trickery image -i"));
368+
assert!(full_help.contains("trickery generate prompts/"));
369+
assert!(full_help.contains("trickery image prompts/"));
381370
assert!(full_help.contains("trickery completion bash"));
382371
assert!(full_help.contains("--var name="));
383372
}

test_cases/basic_generation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Validates that trickery can generate output from a simple prompt file without va
1010
## Steps
1111

1212
### 1. Generate from simple prompt
13-
**Run:** `trickery generate -i prompts/dad_jokes.md`
13+
**Run:** `trickery generate prompts/dad_jokes.md`
1414
**Expect:** LLM response printed to stdout (a dad joke)
1515

1616
### 2. Generate with model selection
17-
**Run:** `trickery generate -i prompts/dad_jokes.md -m gpt-4o-mini`
17+
**Run:** `trickery generate prompts/dad_jokes.md -m gpt-4o-mini`
1818
**Expect:** LLM response from specified model
1919

2020
### 3. Generate with max tokens limit
21-
**Run:** `trickery generate -i prompts/dad_jokes.md --max-tokens 50`
21+
**Run:** `trickery generate prompts/dad_jokes.md --max-tokens 50`
2222
**Expect:** Response truncated to approximately 50 tokens

test_cases/error_handling.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@ Validates proper error messages for invalid inputs and missing requirements.
88

99
## Steps
1010

11-
### 1. Missing input file
11+
### 1. Missing input
1212
**Run:** `trickery generate`
13-
**Expect:** Error: "Input file path is required"
13+
**Expect:** Error: "Input is required"
1414

15-
### 2. Non-existent file
16-
**Run:** `trickery generate -i nonexistent.md`
17-
**Expect:** Error: "Failed to read input file 'nonexistent.md': No such file"
18-
19-
### 3. Missing API key
20-
**Run:** `unset OPENAI_API_KEY && trickery generate -i prompts/dad_jokes.md`
15+
### 2. Missing API key
16+
**Run:** `unset OPENAI_API_KEY && trickery generate prompts/dad_jokes.md`
2117
**Expect:** Error indicating missing or invalid API key
2218

23-
### 4. Invalid variable format
24-
**Run:** `trickery generate -i prompts/dad_jokes.md --var invalidformat`
19+
### 3. Invalid variable format
20+
**Run:** `trickery generate prompts/dad_jokes.md --var invalidformat`
2521
**Expect:** Error: "invalid KEY=VALUE: no `=` found"
2622

27-
### 5. Invalid reasoning level
28-
**Run:** `trickery generate -i prompts/dad_jokes.md -r invalid`
23+
### 4. Invalid reasoning level
24+
**Run:** `trickery generate prompts/dad_jokes.md -r invalid`
2925
**Expect:** Error about invalid reasoning level value

0 commit comments

Comments
 (0)