From 7c6989de0e9aba14f091576728b2b7ff69e62aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Tue, 12 Sep 2023 13:15:55 -0300 Subject: [PATCH] completions: hint generator to expand to file paths --- CHANGELOG.md | 6 +++++- src/cli/args.rs | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 933a092ef..4bfa79e15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -_This changelog was created after v0.3.1 was released. As a result, there may be slight inaccuracies with versions <= v0.3.1._ +_This changelog was created after v0.3.1. As a result, there may be slight inaccuracies with prior versions._ Categories Used: @@ -24,6 +24,10 @@ Categories Used: - Fix size unit inconsistency [\#502](https://github.com/ouch-org/ouch/pull/502) ([marcospb19](https://github.com/marcospb19)) +### Improvements + +- Hint completions generator to expand file paths [\#508](https://github.com/ouch-org/ouch/pull/508) ([marcospb19](https://github.com/marcospb19)) + ## [0.4.2](https://github.com/ouch-org/ouch/compare/0.4.1...0.4.2) ### New Features diff --git a/src/cli/args.rs b/src/cli/args.rs index 266432fab..676f49dc0 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -53,7 +53,7 @@ pub enum Subcommand { #[command(visible_alias = "c")] Compress { /// Files to be compressed - #[arg(required = true, num_args = 1..)] + #[arg(required = true, value_hint = ValueHint::FilePath)] files: Vec, /// The resulting file. Its extensions can be used to specify the compression formats @@ -78,18 +78,18 @@ pub enum Subcommand { #[command(visible_alias = "d")] Decompress { /// Files to be decompressed - #[arg(required = true, num_args = 1..)] + #[arg(required = true, num_args = 1.., value_hint = ValueHint::FilePath)] files: Vec, /// Place results in a directory other than the current one - #[arg(short = 'd', long = "dir", value_hint = ValueHint::DirPath)] + #[arg(short = 'd', long = "dir", value_hint = ValueHint::FilePath)] output_dir: Option, }, /// List contents of an archive #[command(visible_aliases = ["l", "ls"])] List { /// Archives whose contents should be listed - #[arg(required = true, num_args = 1..)] + #[arg(required = true, num_args = 1.., value_hint = ValueHint::FilePath)] archives: Vec, /// Show archive contents as a tree