Skip to content

Commit

Permalink
enhance/hurlfmt: remove depreciated --format option
Browse files Browse the repository at this point in the history
  • Loading branch information
bp7968h authored and hurl-bot committed Nov 29, 2024
1 parent 59dbec8 commit 4660d35
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 35 deletions.
1 change: 0 additions & 1 deletion completions/_hurlfmt
Original file line number Diff line number Diff line change
Expand Up @@ -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]' \
Expand Down
1 change: 0 additions & 1 deletion completions/_hurlfmt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion completions/hurlfmt.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion completions/hurlfmt.fish
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/options/hurlfmt/check.option
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
7 changes: 0 additions & 7 deletions docs/spec/options/hurlfmt/format.option

This file was deleted.

10 changes: 0 additions & 10 deletions packages/hurlfmt/src/cli/options/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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")
Expand Down
12 changes: 0 additions & 12 deletions packages/hurlfmt/src/cli/options/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -49,17 +48,6 @@ pub fn input_format(arg_matches: &ArgMatches) -> Result<InputFormat, OptionsErro
}

pub fn output_format(arg_matches: &ArgMatches) -> Result<OutputFormat, OptionsError> {
// 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),
Expand Down
1 change: 0 additions & 1 deletion packages/hurlfmt/src/cli/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ pub fn parse() -> Result<Options, OptionsError> {
.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())
Expand Down

0 comments on commit 4660d35

Please sign in to comment.