Add cli-only info in option doc

This commit is contained in:
Fabrice Reix 2024-02-29 09:52:54 +01:00 committed by hurl-bot
parent 2433a24887
commit 6b927465fa
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D
11 changed files with 45 additions and 2 deletions

View File

@ -28,13 +28,16 @@ def generate_man_option(option: Option):
s += " {#%s}" % option.long.replace(".", "") s += " {#%s}" % option.long.replace(".", "")
s += "\n\n" s += "\n\n"
s += option.description s += option.description
if option.cli_only:
s += "\n\n"
s += "This is a cli-only option."
return s return s
def main(): def main():
# Parse all options file given at the command line # Parse all options file given at the command line
if len(sys.argv) < 2: if len(sys.argv) < 2:
print("usage: generate_nab.py OPTION_FILE1 OPTION_FILE2 ...") print("usage: generate_man.py OPTION_FILE1 OPTION_FILE2 ...")
sys.exit(1) sys.exit(1)
options = sorted( options = sorted(
[Option.parse_file(filename) for filename in sys.argv[1:]], [Option.parse_file(filename) for filename in sys.argv[1:]],

View File

@ -14,6 +14,7 @@ class Option:
help, help,
conflict, conflict,
append, append,
cli_only,
deprecated, deprecated,
description, description,
): ):
@ -26,6 +27,7 @@ class Option:
self.help = help self.help = help
self.conflict = conflict self.conflict = conflict
self.append = append self.append = append
self.cli_only = cli_only
self.deprecated = deprecated self.deprecated = deprecated
self.description = description self.description = description
@ -44,6 +46,7 @@ class Option:
and self.append == other.append and self.append == other.append
and self.deprecated == other.deprecated and self.deprecated == other.deprecated
and self.description == other.description and self.description == other.description
and self.cli_only == other.cli_only
) )
def __str__(self): def __str__(self):
@ -63,6 +66,8 @@ class Option:
s += "\nconflict: " + " ".join(self.conflict) s += "\nconflict: " + " ".join(self.conflict)
if self.append: if self.append:
s += "\nmulti: append" s += "\nmulti: append"
if self.cli_only:
s += "\ncli_only: true"
if self.deprecated: if self.deprecated:
s += "\ndeprecated: true" s += "\ndeprecated: true"
s += "\n---" s += "\n---"
@ -82,6 +87,7 @@ class Option:
self.conflict, self.conflict,
self.append, self.append,
self.description, self.description,
self.cli_only,
) )
) )
@ -96,6 +102,7 @@ class Option:
help = None help = None
conflict = None conflict = None
append = False append = False
cli_only = False
deprecated = False deprecated = False
description = "" description = ""
in_description = False in_description = False
@ -126,6 +133,13 @@ class Option:
elif key == "multi": elif key == "multi":
if v == "append": if v == "append":
append = True append = True
elif key == "cli_only":
if v == "true":
cli_only = True
elif v == "false":
cli_only = False
else:
raise Exception("Expected true or false for cli attribute")
elif key == "deprecated": elif key == "deprecated":
if v == "true": if v == "true":
deprecated = True deprecated = True
@ -154,6 +168,7 @@ class Option:
help, help,
conflict, conflict,
append, append,
cli_only,
deprecated, deprecated,
description.strip(), description.strip(),
) )

View File

@ -121,7 +121,8 @@ More information on asserts can be found here [https://hurl.dev/docs/asserting-r
Options that exist in curl have exactly the same semantics. Options that exist in curl have exactly the same semantics.
Options specified on the command line are defined for every Hurl file's entry. Options specified on the command line are defined for every Hurl file's entry,
except if they are tagged as cli-only (can not be defined in the Hurl request [Options] entry)
For instance: For instance:
@ -191,6 +192,8 @@ Note that this option does not affect the behavior with multiple input Hurl file
All the input files are executed independently. The result of one file does not affect the execution of the other Hurl files. All the input files are executed independently. The result of one file does not affect the execution of the other Hurl files.
This is a cli-only option.
### -b, --cookie <FILE> {#cookie} ### -b, --cookie <FILE> {#cookie}
Read cookies from FILE (using the Netscape cookie file format). Read cookies from FILE (using the Netscape cookie file format).
@ -217,6 +220,8 @@ Control the format of error message (short by default or long)
Set root directory to import files in Hurl. This is used for files in multipart form data, request body and response output. Set root directory to import files in Hurl. This is used for files in multipart form data, request body and response output.
When it is not explicitly defined, files are relative to the current directory in which Hurl is running. When it is not explicitly defined, files are relative to the current directory in which Hurl is running.
This is a cli-only option.
### --glob <GLOB> {#glob} ### --glob <GLOB> {#glob}
Specify input files that match the given glob pattern. Specify input files that match the given glob pattern.
@ -224,6 +229,8 @@ Specify input files that match the given glob pattern.
Multiple glob flags may be used. This flag supports common Unix glob patterns like *, ? and []. Multiple glob flags may be used. This flag supports common Unix glob patterns like *, ? and [].
However, to avoid your shell accidentally expanding glob patterns before Hurl handles them, you must use single quotes or double quotes around each pattern. However, to avoid your shell accidentally expanding glob patterns before Hurl handles them, you must use single quotes or double quotes around each pattern.
This is a cli-only option.
### -0, --http1.0 {#http10} ### -0, --http1.0 {#http10}
Tells Hurl to use HTTP version 1.0 instead of using its internally preferred HTTP version. Tells Hurl to use HTTP version 1.0 instead of using its internally preferred HTTP version.
@ -347,18 +354,24 @@ Generate HTML report in DIR.
If the HTML report already exists, it will be updated with the new test results. If the HTML report already exists, it will be updated with the new test results.
This is a cli-only option.
### --report-junit <FILE> {#report-junit} ### --report-junit <FILE> {#report-junit}
Generate JUnit File. Generate JUnit File.
If the FILE report already exists, it will be updated with the new test results. If the FILE report already exists, it will be updated with the new test results.
This is a cli-only option.
### --report-tap <FILE> {#report-tap} ### --report-tap <FILE> {#report-tap}
Generate TAP report. Generate TAP report.
If the FILE report already exists, it will be updated with the new test results. If the FILE report already exists, it will be updated with the new test results.
This is a cli-only option.
### --resolve <HOST:PORT:ADDR> {#resolve} ### --resolve <HOST:PORT:ADDR> {#resolve}
Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line. Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line.
@ -379,11 +392,15 @@ Duration in milliseconds between each retry. Default is 1000 ms.
Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run. Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.
This is a cli-only option.
### --to-entry <ENTRY_NUMBER> {#to-entry} ### --to-entry <ENTRY_NUMBER> {#to-entry}
Execute Hurl file to ENTRY_NUMBER (starting at 1). Execute Hurl file to ENTRY_NUMBER (starting at 1).
Ignore the remaining of the file. It is useful for debugging a session. Ignore the remaining of the file. It is useful for debugging a session.
This is a cli-only option.
### --unix-socket <PATH> {#unix-socket} ### --unix-socket <PATH> {#unix-socket}
(HTTP) Connect through this Unix domain socket, instead of using the network. (HTTP) Connect through this Unix domain socket, instead of using the network.

View File

@ -1,6 +1,7 @@
name: continue_on_error name: continue_on_error
long: continue-on-error long: continue-on-error
help: Continue executing requests even if an error occurs help: Continue executing requests even if an error occurs
cli_only: true
--- ---
Continue executing requests to the end of the Hurl file even when an assert error occurs. Continue executing requests to the end of the Hurl file even when an assert error occurs.
By default, Hurl exits after an assert error in the HTTP response. By default, Hurl exits after an assert error in the HTTP response.

View File

@ -2,6 +2,7 @@ name: file_root
long: file-root long: file-root
value: DIR value: DIR
help: Set root directory to import files [default: current directory] help: Set root directory to import files [default: current directory]
cli_only: true
--- ---
Set root directory to import files in Hurl. This is used for files in multipart form data, request body and response output. Set root directory to import files in Hurl. This is used for files in multipart form data, request body and response output.
When it is not explicitly defined, files are relative to the current directory in which Hurl is running. When it is not explicitly defined, files are relative to the current directory in which Hurl is running.

View File

@ -3,6 +3,7 @@ long: glob
value: GLOB value: GLOB
help: Specify input files that match the given GLOB. Multiple glob flags may be used help: Specify input files that match the given GLOB. Multiple glob flags may be used
multi: append multi: append
cli_only: true
--- ---
Specify input files that match the given glob pattern. Specify input files that match the given glob pattern.

View File

@ -2,6 +2,7 @@ name: report_html
long: report-html long: report-html
value: DIR value: DIR
help: Generate HTML report to DIR help: Generate HTML report to DIR
cli_only: true
--- ---
Generate HTML report in DIR. Generate HTML report in DIR.

View File

@ -2,6 +2,7 @@ name: report_junit
long: report-junit long: report-junit
value: FILE value: FILE
help: Write a JUnit XML report to FILE help: Write a JUnit XML report to FILE
cli_only: true
--- ---
Generate JUnit File. Generate JUnit File.

View File

@ -2,6 +2,7 @@ name: report_tap
long: report-tap long: report-tap
value: FILE value: FILE
help: Write a TAP report to FILE help: Write a TAP report to FILE
cli_only: true
--- ---
Generate TAP report. Generate TAP report.

View File

@ -1,5 +1,6 @@
name: test name: test
long: test long: test
help: Activate test mode help: Activate test mode
cli_only: true
--- ---
Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run. Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.

View File

@ -4,6 +4,7 @@ value: ENTRY_NUMBER
value_parser: clap::value_parser!(u32).range(1..) value_parser: clap::value_parser!(u32).range(1..)
help: Execute Hurl file to ENTRY_NUMBER (starting at 1) help: Execute Hurl file to ENTRY_NUMBER (starting at 1)
conflict: interactive conflict: interactive
cli_only: true
--- ---
Execute Hurl file to ENTRY_NUMBER (starting at 1). Execute Hurl file to ENTRY_NUMBER (starting at 1).
Ignore the remaining of the file. It is useful for debugging a session. Ignore the remaining of the file. It is useful for debugging a session.