Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate the generation of negation flags #234

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions RELEASE-CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
## Release Checklist

- Update `README.md`'s Usage section with the output of `xh --help`
- Make sure that all options/flags have corresponding negation in the `NEGATION_FLAGS` list found
in `cli.rs`. The following command should help in getting an up-to-date list.
```
cargo expand --all-features cli | rg -o 'with_name\s*\("([^"]*)"\)' -r ' "--no-$1",' | rg -v 'raw-' | sort
```
- Update `CHANGELOG.md` (rename unreleased header to the current date, add any missing changes).
- Bump up the version in `Cargo.toml` and run `cargo check` to update `Cargo.lock`.
- Run `generate.sh` to update man pages and shell-completion files.
Expand Down
141 changes: 70 additions & 71 deletions completions/_xh
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,37 @@ _xh() {

local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'--raw=[Pass raw request data without extra processing]' \
'--pretty=[Controls output processing]: :(all colors format none)' \
'-s+[Output coloring style]: :(auto solarized monokai fruity)' \
'--style=[Output coloring style]: :(auto solarized monokai fruity)' \
'--response-charset=[Override the response encoding for terminal display purposes]' \
'--response-mime=[Override the response mime type for coloring and formatting for the terminal]' \
'-p+[String specifying what the output should contain]' \
'--print=[String specifying what the output should contain]' \
'-P+[The same as --print but applies only to intermediary requests/responses]' \
'--history-print=[The same as --print but applies only to intermediary requests/responses]' \
'-o+[Save output to FILE instead of stdout]' \
'--output=[Save output to FILE instead of stdout]' \
'--session=[Create, or reuse and update a session]' \
'(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange]' \
'-A+[Specify the auth mechanism]: :(basic bearer digest)' \
'--auth-type=[Specify the auth mechanism]: :(basic bearer digest)' \
'-a+[Authenticate as USER with PASS or with TOKEN]' \
'--auth=[Authenticate as USER with PASS or with TOKEN]' \
'--bearer=[Authenticate with a bearer token]' \
'--max-redirects=[Number of redirects to follow, only respected if `follow` is set]' \
'--timeout=[Connection timeout of the request]' \
'*--proxy=[Use a proxy for a protocol. For example: `--proxy https:http://proxy.host:8080`]' \
'--verify=[If "no", skip SSL verification. If a file path, use it as a CA bundle]' \
'--cert=[Use a client side certificate for SSL]' \
'--cert-key=[A private key file to use with --cert]' \
'--ssl=[Force a particular TLS version]: :(auto ssl2.3 tls1 tls1.1 tls1.2 tls1.3)' \
'--default-scheme=[The default scheme to use if not specified in the URL]' \
'--http-version=[HTTP version to use]: :(1 1.0 1.1 2)' \
'--raw=[Pass raw request data without extra processing]:RAW: ' \
'--pretty=[Controls output processing]:STYLE:(all colors format none)' \
'-s+[Output coloring style]:THEME:(auto solarized monokai fruity)' \
'--style=[Output coloring style]:THEME:(auto solarized monokai fruity)' \
'--response-charset=[Override the response encoding for terminal display purposes]:ENCODING: ' \
'--response-mime=[Override the response mime type for coloring and formatting for the terminal]:MIME_TYPE: ' \
'-p+[String specifying what the output should contain]:FORMAT: ' \
'--print=[String specifying what the output should contain]:FORMAT: ' \
'-P+[The same as --print but applies only to intermediary requests/responses]:FORMAT: ' \
'--history-print=[The same as --print but applies only to intermediary requests/responses]:FORMAT: ' \
'-o+[Save output to FILE instead of stdout]:FILE: ' \
'--output=[Save output to FILE instead of stdout]:FILE: ' \
'--session=[Create, or reuse and update a session]:FILE: ' \
'(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange]:FILE: ' \
'-A+[Specify the auth mechanism]:AUTH_TYPE:(basic bearer digest)' \
'--auth-type=[Specify the auth mechanism]:AUTH_TYPE:(basic bearer digest)' \
'-a+[Authenticate as USER with PASS or with TOKEN]:USER[:PASS] | TOKEN: ' \
'--auth=[Authenticate as USER with PASS or with TOKEN]:USER[:PASS] | TOKEN: ' \
'--bearer=[Authenticate with a bearer token]:TOKEN: ' \
'--max-redirects=[Number of redirects to follow, only respected if `follow` is set]:NUM: ' \
'--timeout=[Connection timeout of the request]:SEC: ' \
'*--proxy=[Use a proxy for a protocol. For example: `--proxy https:http://proxy.host:8080`]:PROTOCOL:URL: ' \
'--verify=[If "no", skip SSL verification. If a file path, use it as a CA bundle]:VERIFY: ' \
'--cert=[Use a client side certificate for SSL]:FILE: ' \
'--cert-key=[A private key file to use with --cert]:FILE: ' \
'--ssl=[Force a particular TLS version]:VERSION:(auto tls1 tls1.1 tls1.2 tls1.3)' \
'--default-scheme=[The default scheme to use if not specified in the URL]:SCHEME: ' \
'--http-version=[HTTP version to use]:VERSION:(1.0 1.1 2)' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-j[(default) Serialize data items from the command line as a JSON object]' \
'--json[(default) Serialize data items from the command line as a JSON object]' \
'-f[Serialize data items from the command line as form fields]' \
Expand Down Expand Up @@ -75,63 +78,59 @@ _xh() {
'--ignore-stdin[Do not attempt to read stdin]' \
'--curl[Print a translation to a `curl` command]' \
'--curl-long[Use the long versions of curl'\''s flags]' \
'--no-all[]' \
'--no-auth[]' \
'--no-auth-type[]' \
'--no-bearer[]' \
'--no-body[]' \
'--no-cert[]' \
'--no-cert-key[]' \
'--no-check-status[]' \
'--no-continue[]' \
'--no-curl[]' \
'--no-curl-long[]' \
'--no-default-scheme[]' \
'--no-download[]' \
'--no-follow[]' \
'--no-form[]' \
'--no-headers[]' \
'--no-history-print[]' \
'--no-http-version[]' \
'--no-https[]' \
'--no-ignore-netrc[]' \
'--no-ignore-stdin[]' \
'--no-help[]' \
'--no-version[]' \
'--no-json[]' \
'--no-max-redirects[]' \
'--no-form[]' \
'--no-multipart[]' \
'--no-native-tls[]' \
'--no-offline[]' \
'--no-output[]' \
'--no-pretty[]' \
'--no-print[]' \
'--no-proxy[]' \
'--no-quiet[]' \
'--no-raw[]' \
'--no-pretty[]' \
'--no-style[]' \
'--no-response-charset[]' \
'--no-response-mime[]' \
'--no-print[]' \
'--no-headers[]' \
'--no-body[]' \
'--no-verbose[]' \
'--no-all[]' \
'--no-history-print[]' \
'--no-quiet[]' \
'--no-stream[]' \
'--no-output[]' \
'--no-download[]' \
'--no-continue[]' \
'--no-session[]' \
'--no-session-read-only[]' \
'--no-ssl[]' \
'--no-stream[]' \
'--no-style[]' \
'--no-auth-type[]' \
'--no-auth[]' \
'--no-bearer[]' \
'--no-ignore-netrc[]' \
'--no-offline[]' \
'--no-check-status[]' \
'--no-follow[]' \
'--no-max-redirects[]' \
'--no-timeout[]' \
'--no-verbose[]' \
'--no-proxy[]' \
'--no-verify[]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':raw-method-or-url -- The request URL, preceded by an optional HTTP method:_files' \
'::raw-rest-args -- Optional key-value pairs to be included in the request:_files' \
'--no-cert[]' \
'--no-cert-key[]' \
'--no-ssl[]' \
'--no-native-tls[]' \
'--no-default-scheme[]' \
'--no-https[]' \
'--no-http-version[]' \
'--no-ignore-stdin[]' \
'--no-curl[]' \
'--no-curl-long[]' \
':raw-method-or-url -- The request URL, preceded by an optional HTTP method:' \
'*::raw-rest-args -- Optional key-value pairs to be included in the request:' \
&& ret=0

}

(( $+functions[_xh_commands] )) ||
_xh_commands() {
local commands; commands=(

)
local commands; commands=()
_describe -t commands 'xh commands' commands "$@"
}

_xh "$@"
_xh "$@"
74 changes: 38 additions & 36 deletions completions/_xh.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Register-ArgumentCompleter -Native -CommandName 'xh' -ScriptBlock {
[CompletionResult]::new('--ssl', 'ssl', [CompletionResultType]::ParameterName, 'Force a particular TLS version')
[CompletionResult]::new('--default-scheme', 'default-scheme', [CompletionResultType]::ParameterName, 'The default scheme to use if not specified in the URL')
[CompletionResult]::new('--http-version', 'http-version', [CompletionResultType]::ParameterName, 'HTTP version to use')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version information')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version information')
[CompletionResult]::new('-j', 'j', [CompletionResultType]::ParameterName, '(default) Serialize data items from the command line as a JSON object')
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, '(default) Serialize data items from the command line as a JSON object')
[CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Serialize data items from the command line as form fields')
Expand Down Expand Up @@ -80,51 +83,50 @@ Register-ArgumentCompleter -Native -CommandName 'xh' -ScriptBlock {
[CompletionResult]::new('--ignore-stdin', 'ignore-stdin', [CompletionResultType]::ParameterName, 'Do not attempt to read stdin')
[CompletionResult]::new('--curl', 'curl', [CompletionResultType]::ParameterName, 'Print a translation to a `curl` command')
[CompletionResult]::new('--curl-long', 'curl-long', [CompletionResultType]::ParameterName, 'Use the long versions of curl''s flags')
[CompletionResult]::new('--no-all', 'no-all', [CompletionResultType]::ParameterName, 'no-all')
[CompletionResult]::new('--no-auth', 'no-auth', [CompletionResultType]::ParameterName, 'no-auth')
[CompletionResult]::new('--no-auth-type', 'no-auth-type', [CompletionResultType]::ParameterName, 'no-auth-type')
[CompletionResult]::new('--no-bearer', 'no-bearer', [CompletionResultType]::ParameterName, 'no-bearer')
[CompletionResult]::new('--no-body', 'no-body', [CompletionResultType]::ParameterName, 'no-body')
[CompletionResult]::new('--no-cert', 'no-cert', [CompletionResultType]::ParameterName, 'no-cert')
[CompletionResult]::new('--no-cert-key', 'no-cert-key', [CompletionResultType]::ParameterName, 'no-cert-key')
[CompletionResult]::new('--no-check-status', 'no-check-status', [CompletionResultType]::ParameterName, 'no-check-status')
[CompletionResult]::new('--no-continue', 'no-continue', [CompletionResultType]::ParameterName, 'no-continue')
[CompletionResult]::new('--no-curl', 'no-curl', [CompletionResultType]::ParameterName, 'no-curl')
[CompletionResult]::new('--no-curl-long', 'no-curl-long', [CompletionResultType]::ParameterName, 'no-curl-long')
[CompletionResult]::new('--no-default-scheme', 'no-default-scheme', [CompletionResultType]::ParameterName, 'no-default-scheme')
[CompletionResult]::new('--no-download', 'no-download', [CompletionResultType]::ParameterName, 'no-download')
[CompletionResult]::new('--no-follow', 'no-follow', [CompletionResultType]::ParameterName, 'no-follow')
[CompletionResult]::new('--no-form', 'no-form', [CompletionResultType]::ParameterName, 'no-form')
[CompletionResult]::new('--no-headers', 'no-headers', [CompletionResultType]::ParameterName, 'no-headers')
[CompletionResult]::new('--no-history-print', 'no-history-print', [CompletionResultType]::ParameterName, 'no-history-print')
[CompletionResult]::new('--no-http-version', 'no-http-version', [CompletionResultType]::ParameterName, 'no-http-version')
[CompletionResult]::new('--no-https', 'no-https', [CompletionResultType]::ParameterName, 'no-https')
[CompletionResult]::new('--no-ignore-netrc', 'no-ignore-netrc', [CompletionResultType]::ParameterName, 'no-ignore-netrc')
[CompletionResult]::new('--no-ignore-stdin', 'no-ignore-stdin', [CompletionResultType]::ParameterName, 'no-ignore-stdin')
[CompletionResult]::new('--no-help', 'no-help', [CompletionResultType]::ParameterName, 'no-help')
[CompletionResult]::new('--no-version', 'no-version', [CompletionResultType]::ParameterName, 'no-version')
[CompletionResult]::new('--no-json', 'no-json', [CompletionResultType]::ParameterName, 'no-json')
[CompletionResult]::new('--no-max-redirects', 'no-max-redirects', [CompletionResultType]::ParameterName, 'no-max-redirects')
[CompletionResult]::new('--no-form', 'no-form', [CompletionResultType]::ParameterName, 'no-form')
[CompletionResult]::new('--no-multipart', 'no-multipart', [CompletionResultType]::ParameterName, 'no-multipart')
[CompletionResult]::new('--no-native-tls', 'no-native-tls', [CompletionResultType]::ParameterName, 'no-native-tls')
[CompletionResult]::new('--no-offline', 'no-offline', [CompletionResultType]::ParameterName, 'no-offline')
[CompletionResult]::new('--no-output', 'no-output', [CompletionResultType]::ParameterName, 'no-output')
[CompletionResult]::new('--no-pretty', 'no-pretty', [CompletionResultType]::ParameterName, 'no-pretty')
[CompletionResult]::new('--no-print', 'no-print', [CompletionResultType]::ParameterName, 'no-print')
[CompletionResult]::new('--no-proxy', 'no-proxy', [CompletionResultType]::ParameterName, 'no-proxy')
[CompletionResult]::new('--no-quiet', 'no-quiet', [CompletionResultType]::ParameterName, 'no-quiet')
[CompletionResult]::new('--no-raw', 'no-raw', [CompletionResultType]::ParameterName, 'no-raw')
[CompletionResult]::new('--no-pretty', 'no-pretty', [CompletionResultType]::ParameterName, 'no-pretty')
[CompletionResult]::new('--no-style', 'no-style', [CompletionResultType]::ParameterName, 'no-style')
[CompletionResult]::new('--no-response-charset', 'no-response-charset', [CompletionResultType]::ParameterName, 'no-response-charset')
[CompletionResult]::new('--no-response-mime', 'no-response-mime', [CompletionResultType]::ParameterName, 'no-response-mime')
[CompletionResult]::new('--no-print', 'no-print', [CompletionResultType]::ParameterName, 'no-print')
[CompletionResult]::new('--no-headers', 'no-headers', [CompletionResultType]::ParameterName, 'no-headers')
[CompletionResult]::new('--no-body', 'no-body', [CompletionResultType]::ParameterName, 'no-body')
[CompletionResult]::new('--no-verbose', 'no-verbose', [CompletionResultType]::ParameterName, 'no-verbose')
[CompletionResult]::new('--no-all', 'no-all', [CompletionResultType]::ParameterName, 'no-all')
[CompletionResult]::new('--no-history-print', 'no-history-print', [CompletionResultType]::ParameterName, 'no-history-print')
[CompletionResult]::new('--no-quiet', 'no-quiet', [CompletionResultType]::ParameterName, 'no-quiet')
[CompletionResult]::new('--no-stream', 'no-stream', [CompletionResultType]::ParameterName, 'no-stream')
[CompletionResult]::new('--no-output', 'no-output', [CompletionResultType]::ParameterName, 'no-output')
[CompletionResult]::new('--no-download', 'no-download', [CompletionResultType]::ParameterName, 'no-download')
[CompletionResult]::new('--no-continue', 'no-continue', [CompletionResultType]::ParameterName, 'no-continue')
[CompletionResult]::new('--no-session', 'no-session', [CompletionResultType]::ParameterName, 'no-session')
[CompletionResult]::new('--no-session-read-only', 'no-session-read-only', [CompletionResultType]::ParameterName, 'no-session-read-only')
[CompletionResult]::new('--no-ssl', 'no-ssl', [CompletionResultType]::ParameterName, 'no-ssl')
[CompletionResult]::new('--no-stream', 'no-stream', [CompletionResultType]::ParameterName, 'no-stream')
[CompletionResult]::new('--no-style', 'no-style', [CompletionResultType]::ParameterName, 'no-style')
[CompletionResult]::new('--no-auth-type', 'no-auth-type', [CompletionResultType]::ParameterName, 'no-auth-type')
[CompletionResult]::new('--no-auth', 'no-auth', [CompletionResultType]::ParameterName, 'no-auth')
[CompletionResult]::new('--no-bearer', 'no-bearer', [CompletionResultType]::ParameterName, 'no-bearer')
[CompletionResult]::new('--no-ignore-netrc', 'no-ignore-netrc', [CompletionResultType]::ParameterName, 'no-ignore-netrc')
[CompletionResult]::new('--no-offline', 'no-offline', [CompletionResultType]::ParameterName, 'no-offline')
[CompletionResult]::new('--no-check-status', 'no-check-status', [CompletionResultType]::ParameterName, 'no-check-status')
[CompletionResult]::new('--no-follow', 'no-follow', [CompletionResultType]::ParameterName, 'no-follow')
[CompletionResult]::new('--no-max-redirects', 'no-max-redirects', [CompletionResultType]::ParameterName, 'no-max-redirects')
[CompletionResult]::new('--no-timeout', 'no-timeout', [CompletionResultType]::ParameterName, 'no-timeout')
[CompletionResult]::new('--no-verbose', 'no-verbose', [CompletionResultType]::ParameterName, 'no-verbose')
[CompletionResult]::new('--no-proxy', 'no-proxy', [CompletionResultType]::ParameterName, 'no-proxy')
[CompletionResult]::new('--no-verify', 'no-verify', [CompletionResultType]::ParameterName, 'no-verify')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information')
[CompletionResult]::new('--no-cert', 'no-cert', [CompletionResultType]::ParameterName, 'no-cert')
[CompletionResult]::new('--no-cert-key', 'no-cert-key', [CompletionResultType]::ParameterName, 'no-cert-key')
[CompletionResult]::new('--no-ssl', 'no-ssl', [CompletionResultType]::ParameterName, 'no-ssl')
[CompletionResult]::new('--no-native-tls', 'no-native-tls', [CompletionResultType]::ParameterName, 'no-native-tls')
[CompletionResult]::new('--no-default-scheme', 'no-default-scheme', [CompletionResultType]::ParameterName, 'no-default-scheme')
[CompletionResult]::new('--no-https', 'no-https', [CompletionResultType]::ParameterName, 'no-https')
[CompletionResult]::new('--no-http-version', 'no-http-version', [CompletionResultType]::ParameterName, 'no-http-version')
[CompletionResult]::new('--no-ignore-stdin', 'no-ignore-stdin', [CompletionResultType]::ParameterName, 'no-ignore-stdin')
[CompletionResult]::new('--no-curl', 'no-curl', [CompletionResultType]::ParameterName, 'no-curl')
[CompletionResult]::new('--no-curl-long', 'no-curl-long', [CompletionResultType]::ParameterName, 'no-curl-long')
break
}
})
Expand Down
Loading