Crates.io | clap-permission-flag |
lib.rs | clap-permission-flag |
version | 0.3.0 |
source | src |
created_at | 2018-08-06 19:33:44.74569 |
updated_at | 2022-09-29 06:36:45.421839 |
description | Drop permissions of a CLI using clap |
homepage | |
repository | https://github.com/rust-clique/clap-permission-flag |
max_upload_size | |
id | 77792 |
size | 48,926 |
Drop permissions of a CLI using structopt.
use clap::Parser;
#[derive(Debug, Parser)]
struct Cli {
#[clap(flatten)]
permission: clap_permission_flag::Permission,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Cli::parse();
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.
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 <chroot> Change the process root directory
-g, --group <group> Change the process group
-u, --user <user> Change the process user
$ 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:
[dependencies.clap-permission-flag]
version = "0.2"
features = ["chroot"]
MIT OR Apache-2.0