-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: simplify and make friendlier and more Unix-like #100
Comments
There's already a CLI UX rewrite in the freeze-feat branch slated for merge. Some of these concerns have been addressed there so it may be better to build off that. |
@CheerfulPianissimo true that, I'll take a look and give feedback (and contributions, if needed) there. Thanks. I see it's been rewritten with clap+derive, and "-" is used for stdout, pretty good 👍 |
This "improves" (and that is subjective) the design of the CLI. I am aiming to get some feedback on what people think of the new design: ``` Screenshot tool for wlroots based compositors implementing the zwlr_screencopy_v1 protocol. Usage: wayshot [OPTIONS] [OUTPUT] Arguments: [OUTPUT] Where to save the screenshot, "-" for stdout. Defaults to "$UNIX_TIMESTAMP-wayshot.$EXTENSION" Options: --log-level <LOG_LEVEL> Log level to be used for printing to stderr [default: info] [possible values: trace, debug, info, warn, error] -s, --slurp <SLURP_ARGS> Arguments to call slurp with for selecting a region -c, --cursor Enable cursor in screenshots --encoding <FILE_EXTENSION> Set image encoder, if output file contains an extension, that will be used instead [default: png] [aliases: extension, format, output-format] Possible values: - jpg: JPG/JPEG encoder - png: PNG encoder - ppm: PPM encoder - qoi: Qut encoder -l, --list-outputs List all valid outputs -o, --output <OUTPUT> Choose a particular output/display to screenshot --choose-output Present a fuzzy selector for output/display selection -h, --help Print help (see a summary with '-h') -V, --version Print version ``` The main changes are: 1. `--debug` is now `--log-level` because this makes it easy to select more specifically what log level to use. I considered using `-v`, `-vv`... to increase verbosity but the `clap-verbosity-crate` uses `log` and not `tracing`. We could use it somewhat, but we'd pull in `log` (which seems fine) and we'd need to map from `log`'s Level to `tracing`'s Level enums (they use inverse ordering). 2. `--stdout` and `--file` has been made an optional positional argument. This because it's what other CLIs often do and I wasn't sure what to call the option otherwise because `--output` and `-O`/`-o` is often what others use but we use it here to refer to displays/monitors/Wayland outputs. This avoids that confusion hopefully and I've also clarified this in the documentation. * Additionally if a path is given, its extension will always be used. So you cannot save `jpg` to `foo.png`. Perhaps this behaviour can be changed, though I don't see a reason to support this weird edge case? When is someone saving `png` to `jpg`? 3. `--extension` is `--encoding` with aliases like `extension`. Again, let me know what you think.
These seem to be the only issues left in the freeze branch:
|
I've just noticed, that #104 partially breaks what's being asked in this issue, the |
I disagree that one should send output to the stdout AND to an additional file. This is confusing and not implemented anywhere else. Could you give a good usecase where this behaviour is desired? |
Also the |
I find myself asking the question: "why not?" |
But there's also the question of "is anyone going to realistically use this?" |
Here are some of the issues:
--listoutputs
->--list-outputs
--choseoutputs
->--choose-outputs
cp
,mv
,curl
,wget
,rg
have it like that.--file <PATH>
and--stdout
can be replaced with optional[FILE]
argument.-
for stdout is a common Unix convention.--help
)--debug
to the end of the help, because that's not what a user typically looks for when learning how to use a new toolrustic
's (permalink)--list-outputs
Currently, output of
--list-outputs
isn't suitable to pipe to another selector (fzf
/skim
or GUI dmenu-likefuzzel
,wofi
), because it's done viatracing
:wayshot/wayshot/src/wayshot.rs
Lines 75 to 81 in cb6bd68
It's output to stderr and exits with an error code
1
for no reason.Should be: just 1 output per line to stdout, and 0 exit code. Good for:
wayshot --output "$(wayshot --list-outputs | fuzzel --dmenu)"
to be bound to a specific hotkey, like
PrintScreen
.clap
is used for CLI,clap_complete
is one step away. Completion scripts can be generated during build time, there is alreadybulid.rs
in the projectI'll make a draft PR to address those issues, to me all of them are straight improvements of
wayshot
's UX.The text was updated successfully, but these errors were encountered: