Skip to content

Commit cfe7ddd

Browse files
authored
feat: Improve CLI help readability and fix config path docs (#305)
## Summary - Cleaner, better organized `--help` output - `--init-config` help text now shows the correct macOS config path - Uses clap's derive API for easier maintenance ## Test plan - [x] Run `t-rec --help` and verify improved formatting - [x] Run `t-rec --init-config` on macOS and verify correct path is used
1 parent 8b760df commit cfe7ddd

File tree

12 files changed

+287
-1064
lines changed

12 files changed

+287
-1064
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
.idea
1010
.test-env
1111
t-rec*.gif
12+
t-rec*.mp4
13+
requirements/
1214

1315
# End of https://www.toptal.com/developers/gitignore/api/rust

Cargo.lock

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ dialoguer = { version = "0.12", default-features = false }
3333

3434
[dependencies.clap]
3535
version = "4.5"
36-
features = ["cargo"]
36+
features = ["cargo", "derive", "help", "color", "std"]
37+
default-features = false
3738

3839
[dependencies.image]
3940
version = "0.25"

README.md

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -134,51 +134,56 @@ t-rec /bin/sh
134134
### Full Options
135135

136136
```text
137-
t-rec 0.7.6
138-
Sven Assmann <sven.assmann.it@gmail.com>
139137
Blazingly fast terminal recorder that generates animated gif images for the web written in rust.
140138
141-
Usage: t-rec [OPTIONS] [shell or program to launch]
139+
Usage:
142140
143141
Arguments:
144-
[shell or program to launch] If you want to start a different program than $SHELL you can
145-
pass it here. For example '/bin/sh'
142+
[PROGRAM] Shell or program to launch. Defaults to $SHELL
146143
147144
Options:
148-
-v, --verbose Enable verbose insights for the curious
149-
-q, --quiet Quiet mode, suppresses the banner:
150-
'Press Ctrl+D to end recording'
151-
-m, --video Generates additionally to the gif a mp4 video of the recording
152-
-M, --video-only Generates only a mp4 video and not gif
153-
-d, --decor <decor> Decorates the animation with certain, mostly border effects
154-
[default: none] [possible values: shadow, none]
155-
-b, --bg <bg> Background color when decors are used [default: transparent]
156-
[possible values: white, black, transparent]
157-
-n, --natural If you want a very natural typing experience and disable the idle
158-
detection and sampling optimization
159-
-l, --ls-win If you want to see a list of windows available for recording by
160-
their id, you can set env var 'WINDOWID' or `--win-id` to record
161-
this specific window only
162-
-w, --win-id <win-id> Window Id (see --ls-win) that should be captured, instead of
163-
the current terminal
164-
-e, --end-pause <s | ms | m> to specify the pause time at the end of the animation, that time
165-
the gif will show the last frame
166-
-s, --start-pause <s | ms | m> to specify the pause time at the start of the animation, that time
167-
the gif will show the first frame
168-
-i, --idle-pause <s | ms | m> to preserve natural pauses up to a maximum duration by overriding
169-
idle detection. Can enhance readability. [default: 3s]
170-
-o, --output <file> to specify the output file (without extension) [default: t-rec]
171-
-f, --fps <4-15> Capture framerate. Higher = smoother animations but larger
172-
files [default: 4]
173-
-p, --wallpaper <wallpaper> Wallpaper background. Use 'ventura' for built-in, or provide
174-
a path to a custom image (PNG, JPEG, TGA)
175-
--wallpaper-padding <1-500> Padding in pixels around the recording when using --wallpaper
176-
[default: 60]
177-
--profile <name> Use a named profile from the config file
178-
--init-config Create a starter config file at ~/.config/t-rec/config.toml
179-
--list-profiles List available profiles from the config file
180-
-h, --help Print help
181-
-V, --version Print version
145+
-v, --verbose
146+
Enable verbose insights for the curious
147+
-q, --quiet
148+
Quiet mode, suppresses the banner: 'Press Ctrl+D to end recording'
149+
-m, --video
150+
Generates additionally to the gif a mp4 video of the recording
151+
-M, --video-only
152+
Generates only a mp4 video and not gif
153+
-d, --decor <DECOR>
154+
Decorates the animation with certain, mostly border effects [default: none] [possible values: shadow, none]
155+
-p, --wallpaper <WALLPAPER>
156+
Wallpaper background. Use 'ventura' for built-in, or provide a path to a custom image (PNG, JPEG, TGA)
157+
--wallpaper-padding <WALLPAPER_PADDING>
158+
Padding in pixels around the recording when using --wallpaper [default: 60]
159+
-b, --bg <BG>
160+
Background color when decors are used [default: transparent] [possible values: white, black, transparent]
161+
-n, --natural
162+
If you want a very natural typing experience and disable the idle detection and sampling optimization
163+
-l, --ls-win
164+
If you want to see a list of windows available for recording by their id [aliases: --ls]
165+
-w, --win-id <WIN_ID>
166+
Window Id (see --ls-win) that should be captured, instead of the current terminal
167+
-e, --end-pause <END_PAUSE>
168+
Pause time at the end of the animation (e.g., "2s", "500ms")
169+
-s, --start-pause <START_PAUSE>
170+
Pause time at the start of the animation (e.g., "1s", "200ms")
171+
-i, --idle-pause <IDLE_PAUSE>
172+
Max idle time before optimization kicks in. Can enhance readability [default: 3s]
173+
-o, --output <OUTPUT>
174+
Output file without extension [default: t-rec]
175+
-f, --fps <FPS>
176+
Capture framerate, 4-15 fps. Higher = smoother but larger files [default: 4]
177+
--profile <PROFILE>
178+
Use a named profile from the config file
179+
--init-config
180+
Create a starter config file at `~/.config/t-rec/config.toml` (linux) or `~/Library/Application Support/t-rec/config.toml` (macOS)
181+
--list-profiles
182+
List available profiles from the config file
183+
-h, --help
184+
Print help
185+
-V, --version
186+
Print version
182187
```
183188

184189
### Configuration File
@@ -200,7 +205,8 @@ t-rec --profile demo
200205

201206
**Config file locations** (searched in order):
202207
1. `./t-rec.toml` (project-local)
203-
2. `~/.config/t-rec/config.toml` (Linux/macOS)
208+
2. `~/.config/t-rec/config.toml` (Linux)
209+
2. `~/Library/Application Support/t-rec/config.toml` (macOS)
204210
3. `%APPDATA%\t-rec\config.toml` (Windows)
205211

206212
**Example config file:**

0 commit comments

Comments
 (0)