diff --git a/README.md b/README.md index 0bacdb1..f4b9d65 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Options: -O, --overwrite-str same as --overwrite, but accepts strings instead Nix expressions -l, --list-fetchers List all available fetchers + -L, --list-possible-fetchers List all fetchers that can be generated without --fetcher -h, --help Print help information -V, --version Print version information ``` @@ -63,7 +64,7 @@ Options: - `nix-prefetch` relies on FOD which is slow, `nurl` tries to use alternatives when possible. - `nix-prefetch` supports arbitrary expressions (planned for `nurl`) and file attributes. - `nix-prefetch` is more configurable and has an interface similar to `nix-build`. -- `nurl` has some nice features dedicated to generated packages (`--indent`, `--list-fetchers`). +- `nurl` has some nice features dedicated to generated packages (`--indent`, `--list-possible-fetchers`). ## Changelog diff --git a/src/cli.rs b/src/cli.rs index 531c1b8..f361b1e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -66,6 +66,10 @@ pub struct Opts { /// List all available fetchers #[arg(short, long, group = "command")] pub list_fetchers: bool, + + /// List all fetchers that can be generated without --fetcher + #[arg(short = 'L', long, group = "command")] + pub list_possible_fetchers: bool, } #[derive(Clone, Debug, ValueEnum)] diff --git a/src/main.rs b/src/main.rs index 83ecb84..657454c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,13 +30,12 @@ pub enum GitScheme { fn main() -> Result<()> { let opts = Opts::parse(); - if opts.list_fetchers { + if opts.list_fetchers || opts.list_possible_fetchers { let mut out = stdout().lock(); - for fetcher in FetcherFunction::value_variants() - .iter() - .filter_map(ValueEnum::to_possible_value) - { - writeln!(out, "{}", fetcher.get_name())?; + for fetcher in FetcherFunction::value_variants() { + if let Some(fetcher) = fetcher.to_possible_value() { + writeln!(out, "{}", fetcher.get_name())?; + } } return Ok(()); }