From 4660d3547322e2563f1144efd1ba0606b8abf945 Mon Sep 17 00:00:00 2001 From: Bhuwan Pandit Date: Tue, 26 Nov 2024 21:11:41 +0000 Subject: [PATCH] enhance/hurlfmt: remove depreciated --format option --- completions/_hurlfmt | 1 - completions/_hurlfmt.ps1 | 1 - completions/hurlfmt.bash | 2 +- completions/hurlfmt.fish | 1 - docs/spec/options/hurlfmt/check.option | 2 +- docs/spec/options/hurlfmt/format.option | 7 ------- packages/hurlfmt/src/cli/options/commands.rs | 10 ---------- packages/hurlfmt/src/cli/options/matches.rs | 12 ------------ packages/hurlfmt/src/cli/options/mod.rs | 1 - 9 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 docs/spec/options/hurlfmt/format.option diff --git a/completions/_hurlfmt b/completions/_hurlfmt index 257a785e080..0fc46577408 100644 --- a/completions/_hurlfmt +++ b/completions/_hurlfmt @@ -17,7 +17,6 @@ _hurlfmt() { _arguments "${_arguments_options[@]}" \ '--check[Run in check mode]' \ '--color[Colorize Output]' \ - '--format[Specify output format: hurl, json or html]: :' \ '--in-place[Modify files in place]' \ '--in[Specify input format: hurl or curl]: :' \ '--no-color[Do not colorize output]' \ diff --git a/completions/_hurlfmt.ps1 b/completions/_hurlfmt.ps1 index 382417ac4f5..0fcbd04b902 100644 --- a/completions/_hurlfmt.ps1 +++ b/completions/_hurlfmt.ps1 @@ -22,7 +22,6 @@ Register-ArgumentCompleter -Native -CommandName 'hurlfmt' -ScriptBlock { 'hurlfmt' {[CompletionResult]::new('--check', 'check', [CompletionResultType]::ParameterName, 'Run in check mode') [CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'Colorize Output') - [CompletionResult]::new('--format', 'format', [CompletionResultType]::ParameterName, 'Specify output format: hurl, json or html') [CompletionResult]::new('--in-place', 'in-place', [CompletionResultType]::ParameterName, 'Modify files in place') [CompletionResult]::new('--in', 'in', [CompletionResultType]::ParameterName, 'Specify input format: hurl or curl') [CompletionResult]::new('--no-color', 'no-color', [CompletionResultType]::ParameterName, 'Do not colorize output') diff --git a/completions/hurlfmt.bash b/completions/hurlfmt.bash index 27a09275cdc..930eab4987d 100644 --- a/completions/hurlfmt.bash +++ b/completions/hurlfmt.bash @@ -5,7 +5,7 @@ _hurlfmt() _init_completion || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '--check --color --format --in-place --in --no-color --output --out --standalone --help --version' -- "$cur")) + COMPREPLY=($(compgen -W '--check --color --in-place --in --no-color --output --out --standalone --help --version' -- "$cur")) return fi diff --git a/completions/hurlfmt.fish b/completions/hurlfmt.fish index 9c5e6d03d1b..0d125e4a5ed 100644 --- a/completions/hurlfmt.fish +++ b/completions/hurlfmt.fish @@ -1,6 +1,5 @@ complete -c hurlfmt -l check -d 'Run in check mode' complete -c hurlfmt -l color -d 'Colorize Output' -complete -c hurlfmt -l format -d 'Specify output format: hurl, json or html' complete -c hurlfmt -l in-place -d 'Modify files in place' complete -c hurlfmt -l in -d 'Specify input format: hurl or curl' complete -c hurlfmt -l no-color -d 'Do not colorize output' diff --git a/docs/spec/options/hurlfmt/check.option b/docs/spec/options/hurlfmt/check.option index 8693252dfc2..ac1e24290a2 100644 --- a/docs/spec/options/hurlfmt/check.option +++ b/docs/spec/options/hurlfmt/check.option @@ -1,7 +1,7 @@ name: check long: check help: Run in check mode -conflict: format output +conflict: output --- Run in check mode. Exits with 0 if input is formatted correctly, 1 otherwise. diff --git a/docs/spec/options/hurlfmt/format.option b/docs/spec/options/hurlfmt/format.option deleted file mode 100644 index 1a9185c0bec..00000000000 --- a/docs/spec/options/hurlfmt/format.option +++ /dev/null @@ -1,7 +0,0 @@ -name: format -long: format -value: FORMAT -help: Specify output format: hurl, json or html -deprecated: true ---- -Specify output format: hurl, json or html. diff --git a/packages/hurlfmt/src/cli/options/commands.rs b/packages/hurlfmt/src/cli/options/commands.rs index f99d5200d38..dd18217f473 100644 --- a/packages/hurlfmt/src/cli/options/commands.rs +++ b/packages/hurlfmt/src/cli/options/commands.rs @@ -30,7 +30,6 @@ pub fn check() -> clap::Arg { clap::Arg::new("check") .long("check") .help("Run in check mode") - .conflicts_with("format") .conflicts_with("output") .action(clap::ArgAction::SetTrue) } @@ -44,15 +43,6 @@ pub fn color() -> clap::Arg { .action(clap::ArgAction::SetTrue) } -pub fn format() -> clap::Arg { - clap::Arg::new("format") - .long("format") - .value_name("FORMAT") - .help("Specify output format: hurl, json or html") - .num_args(1) - .hide(true) -} - pub fn in_place() -> clap::Arg { clap::Arg::new("in_place") .long("in-place") diff --git a/packages/hurlfmt/src/cli/options/matches.rs b/packages/hurlfmt/src/cli/options/matches.rs index aaf1baf11cf..8bc1b48adca 100644 --- a/packages/hurlfmt/src/cli/options/matches.rs +++ b/packages/hurlfmt/src/cli/options/matches.rs @@ -19,7 +19,6 @@ use std::io; use std::io::IsTerminal; use std::path::{Path, PathBuf}; -use clap::parser::ValueSource; use clap::ArgMatches; use hurl_core::input::Input; @@ -49,17 +48,6 @@ pub fn input_format(arg_matches: &ArgMatches) -> Result Result { - // Deprecated --format option - if arg_matches.value_source("format") == Some(ValueSource::CommandLine) { - eprintln!("--format is deprecated. use --out instead."); - return match get_string(arg_matches, "format").unwrap().as_str() { - "hurl" => Ok(OutputFormat::Hurl), - "json" => Ok(OutputFormat::Json), - "html" => Ok(OutputFormat::Html), - v => Err(OptionsError::Error(format!("Invalid output format {v}"))), - }; - } - match get_string(arg_matches, "output_format").unwrap().as_str() { "hurl" => Ok(OutputFormat::Hurl), "json" => Ok(OutputFormat::Json), diff --git a/packages/hurlfmt/src/cli/options/mod.rs b/packages/hurlfmt/src/cli/options/mod.rs index 53cdd8cf97c..cee245b3b14 100644 --- a/packages/hurlfmt/src/cli/options/mod.rs +++ b/packages/hurlfmt/src/cli/options/mod.rs @@ -73,7 +73,6 @@ pub fn parse() -> Result { .about("Format Hurl files") .arg(commands::check()) .arg(commands::color()) - .arg(commands::format()) .arg(commands::in_place()) .arg(commands::input_files()) .arg(commands::input_format())