mirror of
https://github.com/nix-community/comma.git
synced 2024-09-11 03:55:24 +03:00
add --print-package
requested in https://github.com/nix-community/comma/issues/38
This commit is contained in:
parent
78456e7c5f
commit
34ba5a05bc
12
src/main.rs
12
src/main.rs
@ -114,6 +114,14 @@ fn main() -> ExitCode {
|
||||
}
|
||||
.contains("nixpkgs");
|
||||
|
||||
if args.print_package {
|
||||
println!(
|
||||
"Package that contains executable /bin/{}: {}",
|
||||
command,
|
||||
&choice.rsplit('.').last().unwrap()
|
||||
);
|
||||
};
|
||||
|
||||
if args.install {
|
||||
Command::new("nix-env")
|
||||
.args(["-f", "<nixpkgs>", "-iA", choice.rsplit('.').last().unwrap()])
|
||||
@ -140,6 +148,10 @@ struct Opt {
|
||||
#[clap(short, long)]
|
||||
update: bool,
|
||||
|
||||
/// Print the package containing the executable
|
||||
#[clap(long = "print-package")]
|
||||
print_package: bool,
|
||||
|
||||
/// Command to run
|
||||
#[clap(required_unless_present = "update", name = "cmd")]
|
||||
cmd: Vec<String>,
|
||||
|
Loading…
Reference in New Issue
Block a user