From 3bccaf524600c99e5358f6222dcc17729d923099 Mon Sep 17 00:00:00 2001 From: Gerry Agbobada <10496163+gagbo@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:53:17 +0100 Subject: [PATCH] Fix completion generation (#264) * Test completion/subcommand parsing in CI * Fix completion/parsing errors on fp views create --- .github/workflows/build.yml | 6 +++++- src/views.rs | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d656f72..1d978a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,11 @@ jobs: clippy_flags: --all-features --release - name: Run tests - run: cargo test --release + run: cargo test --release --all + + # Clap has specific debug asserts when generating completions + - name: Run Completion generation test + run: cargo test generating_completions --bin fp - name: Generate manifest run: target/release/fp version -o json > manifest.json diff --git a/src/views.rs b/src/views.rs index 35a26c7..e2e3731 100644 --- a/src/views.rs +++ b/src/views.rs @@ -64,10 +64,11 @@ struct CreateArguments { description: Option, /// The color the resulting view should be displayed as in Fiberplane Studio - #[clap(value_parser = clap::value_parser!(i16).range(0..10))] + #[clap(long, value_parser = clap::value_parser!(i16).range(0..10))] color: i16, /// Labels which are associated with this newly created view + #[clap(long, short)] labels: Vec, /// Time range value in either seconds, minutes, hours or days (without suffix). @@ -76,13 +77,15 @@ struct CreateArguments { time_range_value: Option, /// Time range unit. Used in conjunction with `time_range_value` - #[clap(requires = "time_range_value")] + #[clap(requires = "time_range_value", value_enum)] time_range_unit: Option, /// What the notebooks displayed in the view should be sorted by, by default + #[clap(value_enum)] sort_by: Option, /// Sort direction displayed by default when opening the view + #[clap(value_enum)] sort_direction: Option, /// Workspace in which this view lives