Skip to content

Commit

Permalink
Merge pull request #24 from messense/possible-values
Browse files Browse the repository at this point in the history
Replace clap `possible_values` with `value_parser`
  • Loading branch information
messense committed Oct 9, 2022
2 parents 5c7bf62 + 2d8b0ed commit 7e564ca
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 12 deletions.
71 changes: 64 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use std::path::{Path, PathBuf};
use std::process::Command;

use anyhow::{Context, Result};
use clap::Parser;
use clap::{
builder::{PossibleValuesParser, TypedValueParser as _},
Parser,
};
use fs_err as fs;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use path_slash::PathExt;
Expand All @@ -23,9 +26,10 @@ pub struct XWinOptions {
#[clap(
long,
env = "XWIN_ARCH",
possible_values = &["x86", "x86_64", "aarch", "aarch64"],
value_parser = PossibleValuesParser::new(["x86", "x86_64", "aarch", "aarch64"])
.map(|s| s.parse::<xwin::Arch>().unwrap()),
use_value_delimiter = true,
default_value = "x86_64,aarch64",
default_values_t = vec![xwin::Arch::X86_64, xwin::Arch::Aarch64],
hide = true,
)]
pub xwin_arch: Vec<xwin::Arch>,
Expand All @@ -34,9 +38,10 @@ pub struct XWinOptions {
#[clap(
long,
env = "XWIN_VARIANT",
possible_values = &["desktop", "onecore", /*"store",*/ "spectre"],
value_parser = PossibleValuesParser::new(["desktop", "onecore", /*"store",*/ "spectre"])
.map(|s| s.parse::<xwin::Variant>().unwrap()),
use_value_delimiter = true,
default_value = "desktop",
default_values_t = vec![xwin::Variant::Desktop],
hide = true,
)]
pub xwin_variant: Vec<xwin::Variant>,
Expand Down

0 comments on commit 7e564ca

Please sign in to comment.