clap-permission-flag

crates.io version build status downloads docs.rs docs

Drop permissions of a CLI using structopt.

Usage

```rust extern crate clappermissionflag;

[macro_use]

extern crate structopt;

use structopt::StructOpt;

[derive(Debug, StructOpt)]

struct Cli { #[structopt(flatten)] permission: clappermissionflag::Permission, }

fn main() -> Result<(), Box> { let args = Cli::from_args(); args.permission.drop()?; Ok(()) } ```

This crate depends on Unix features - on other platforms a stub implementation which has no flags and always succeeds if used.

Example Output

```txt clap-permission-flag 0.2.0 Yoshua Wuyts yoshuawuyts@gmail.com Drop permissions of a CLI using structopt

USAGE: main [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: --chroot Change the process root directory -g, --group Change the process group -u, --user Change the process user ```

Installation

sh $ cargo add clap-permission-flag

Since --chroot may not be suitable for all applications, it is behind the chroot feature and must be enabled explicitly:

toml [dependencies.clap-permission-flag] version = "0.2" features = ["chroot"]

See Also

License

MIT OR Apache-2.0