Skip to content

Commit

Permalink
Improve shell completions
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Oct 17, 2022
1 parent e172d37 commit d91f417
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exports/completion.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
complete -c sane-fmt -l details -d 'File diff detail' -r -f -a "{count ,name ,diff }"
complete -c sane-fmt -l color -d 'When to use terminal color' -r -f -a "{auto ,never ,always }"
complete -c sane-fmt -l log-format -d 'Format of log messages' -r -f -a "{human ,github-actions }"
complete -c sane-fmt -s I -l include -d 'Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)' -r
complete -c sane-fmt -s I -l include -d 'Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)' -r -F
complete -c sane-fmt -l stdio -d 'Reads unformatted code from standard input, prints formatted code to standard output, then exits'
complete -c sane-fmt -s w -l write -d 'Whether to write or check'
complete -c sane-fmt -l hide-passed -d 'Do not log passed filenames'
Expand Down
6 changes: 3 additions & 3 deletions exports/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ _sane-fmt() {
'--details=[File diff detail]:DETAILS:(count name diff)' \
'--color=[When to use terminal color]:COLOR:(auto never always)' \
'--log-format=[Format of log messages]:LOG_FORMAT:(human github-actions)' \
'-I+[Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)]:INCLUDE: ' \
'--include=[Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)]:INCLUDE: ' \
'-I+[Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)]:INCLUDE:_files' \
'--include=[Files whose contents contain paths to target files (`-` means stdin, other strings mean text file)]:INCLUDE:_files' \
'--stdio[Reads unformatted code from standard input, prints formatted code to standard output, then exits]' \
'-w[Whether to write or check]' \
'--write[Whether to write or check]' \
Expand All @@ -28,7 +28,7 @@ _sane-fmt() {
'--help[Print help information (use `--help` for more detail)]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*::files -- Files to process:' \
'*::files -- Files to process:_files' \
&& ret=0
}

Expand Down
5 changes: 3 additions & 2 deletions src/cli_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use input_stream_address::*;
pub use log_format::*;
pub use when::*;

use clap::Parser;
use clap::{Parser, ValueHint};

/// Opinionated code formatter for TypeScript and JavaScript
#[derive(Debug, Parser)]
Expand Down Expand Up @@ -41,11 +41,12 @@ pub struct CliOpt {

/// Files whose contents contain paths to target files
/// (`-` means stdin, other strings mean text file)
#[clap(long, short = 'I')]
#[clap(long, short = 'I', value_hint = ValueHint::FilePath)]
pub include: Option<InputStreamAddress>,

/// Files to process
///
/// If none are provided, a default set of files will be assumed
#[clap(value_hint = ValueHint::AnyPath)]
pub files: Vec<String>,
}

0 comments on commit d91f417

Please sign in to comment.