Module sop::cli

source · []
Expand description

Command-line frontend for SOP.

This is an implementation of the SOP Command-Line protocol in terms of the trait crate::SOP, hence it can be shared between SOP implementations.

To use, add this snippet to Cargo.toml:

[[bin]]
path = "src/main.rs"
required-features = ["cli"]

[features]
cli = ["sop/cli"]

And create src/main.rs along the lines of:

fn main() {
    sop::cli::main(&MySOPImplementation::default());
}

Generating shell completions

To create shell completions, add this snippet to Cargo.toml:

[build-dependencies]
sop = "..."

And create build.rs along the lines of:

#[cfg(feature = "cli")]
fn main() {
    let outdir = std::env::var_os("CARGO_TARGET_DIR")
        .or(std::env::var_os("OUT_DIR"))
        .expect("cargo to set OUT_DIR");
    sop::cli::write_shell_completions("sqop", outdir).unwrap();
}

#[cfg(not(feature = "cli"))]
fn main() {}

Features and limitations

  • The special designator @FD: is only available on UNIX-like systems.

  • On Windows, certs and keys provided via the @ENV: special designator must be ASCII armored and well-formed UTF-8.

Functions

Implements the SOP command-line interface.
Generates shell completions.