Skip to content

Commit

Permalink
chore: Homogenize CLI (#136)
Browse files Browse the repository at this point in the history
`**/README.md`:
- Not all changes are due to this commit.

`**/main.rs`:
- Use the same clap options for all binaries to make the experience of
  using them more consistent; I don't remember there being a reason for
  diverging and a brief search in the git history didn't turn up
  anything either.
- Keep `verbatim_doc_comment` because without it lists are concatenated
  to form a single, long line.
  • Loading branch information
apljungquist authored Nov 25, 2024
1 parent 203eeda commit 7082dce
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
7 changes: 4 additions & 3 deletions crates/acap-ssh-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$ acap-ssh-utils -h
Utilities for interacting with Axis devices over SSH.

Usage: acap-ssh-utils --host <HOST> --user <USER> --pass <PASS> <COMMAND>
Usage: acap-ssh-utils [OPTIONS] --host <HOST> <COMMAND>

Commands:
patch Patch app on device
Expand All @@ -12,7 +12,8 @@ Commands:

Options:
--host <HOST> Hostname or IP address of the device [env: AXIS_DEVICE_IP=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=, default="root"]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=, default="pass"]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=] [default: root]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=] [default: pass]
-h, --help Print help (see more with '--help')
-V, --version Print version
```
2 changes: 1 addition & 1 deletion crates/acap-ssh-utils/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use url::Host;
/// with stdout attached to the terminal are officially supported use cases. As such all commands
/// provided by this program may stop working on future versions AXIS OS.
#[derive(Clone, Debug, Parser)]
#[clap(verbatim_doc_comment)]
#[clap(verbatim_doc_comment, version)]
struct Cli {
#[command(flatten)]
netloc: Netloc,
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-acap-build/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```console
$ cargo-acap-build -h
ACAP analog to `cargo build`
Build app using cargo

Usage: cargo-acap-build [OPTIONS] [ARGS]...

Expand Down
3 changes: 1 addition & 2 deletions crates/cargo-acap-build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ impl From<ArchAbi> for Architecture {
/// - Builds for all supported targets instead of host.
/// - Uses the release profile instead of the dev profile.
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[clap(verbatim_doc_comment, version)]
struct Cli {
/// If given, build only for the given architecture(s).
///
Expand Down
4 changes: 4 additions & 0 deletions crates/cargo-acap-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Commands:
run Build app(s) and run on the device
test Build app(s) in test mode and run on the device
install Build app(s) with release profile and install on the device
start Start app on device
stop Stop app on device
restart Restart app on device
remove Remove app form device
completions Print shell completion script for this program
help Print this message or the help of the given subcommand(s)

Expand Down
3 changes: 1 addition & 2 deletions crates/cargo-acap-sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ mod commands;

/// Tools for developing ACAP apps using Rust
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[clap(verbatim_doc_comment, version)]
struct Cli {
#[command(subcommand)]
command: Commands,
Expand Down
7 changes: 4 additions & 3 deletions crates/device-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$ device-manager -h
Utilities for managing individual devices.

Usage: device-manager --host <HOST> --user <USER> --pass <PASS> <COMMAND>
Usage: device-manager [OPTIONS] --host <HOST> <COMMAND>

Commands:
restore Restore device to a clean state
Expand All @@ -11,9 +11,10 @@ Commands:

Options:
--host <HOST> Hostname or IP address of the device [env: AXIS_DEVICE_IP=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=, default="root"]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=, default="pass"]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=] [default: root]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=] [default: pass]
-h, --help Print help
-V, --version Print version
```

Currently, this crate focuses on restoring devices to a known, useful state.
Expand Down
2 changes: 1 addition & 1 deletion crates/fleet-manager/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```console
$ fleet-manager -h
Utilities for managing devices in bulk
Utilities for managing devices in bulk.

Usage: fleet-manager [FLEET] <COMMAND>

Expand Down
3 changes: 1 addition & 2 deletions crates/fleet-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ mod database;

/// Utilities for managing devices in bulk.
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[clap(verbatim_doc_comment, version)]
struct Cli {
/// Location of database file.
fleet: Option<PathBuf>,
Expand Down

0 comments on commit 7082dce

Please sign in to comment.