Revert "remove --list-possible-fetchers since all fetchers are possible"

This reverts commit c854935b1a.
This commit is contained in:
figsoda 2023-01-02 15:06:10 -05:00
parent c854935b1a
commit 946688974f
3 changed files with 11 additions and 7 deletions

View File

@ -53,6 +53,7 @@ Options:
-O, --overwrite-str <NAME> <STRING> same as --overwrite, but accepts strings instead Nix -O, --overwrite-str <NAME> <STRING> same as --overwrite, but accepts strings instead Nix
expressions expressions
-l, --list-fetchers List all available fetchers -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 -h, --help Print help information
-V, --version Print version 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` 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` supports arbitrary expressions (planned for `nurl`) and file attributes.
- `nix-prefetch` is more configurable and has an interface similar to `nix-build`. - `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 ## Changelog

View File

@ -66,6 +66,10 @@ pub struct Opts {
/// List all available fetchers /// List all available fetchers
#[arg(short, long, group = "command")] #[arg(short, long, group = "command")]
pub list_fetchers: bool, 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)] #[derive(Clone, Debug, ValueEnum)]

View File

@ -30,13 +30,12 @@ pub enum GitScheme {
fn main() -> Result<()> { fn main() -> Result<()> {
let opts = Opts::parse(); let opts = Opts::parse();
if opts.list_fetchers { if opts.list_fetchers || opts.list_possible_fetchers {
let mut out = stdout().lock(); let mut out = stdout().lock();
for fetcher in FetcherFunction::value_variants() for fetcher in FetcherFunction::value_variants() {
.iter() if let Some(fetcher) = fetcher.to_possible_value() {
.filter_map(ValueEnum::to_possible_value) writeln!(out, "{}", fetcher.get_name())?;
{ }
writeln!(out, "{}", fetcher.get_name())?;
} }
return Ok(()); return Ok(());
} }