doc: improve usage output
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Glenn Y. Rolland 2024-01-03 18:14:03 +01:00
parent a39680de4f
commit 29a13e28cd
2 changed files with 29 additions and 26 deletions

View file

@ -74,17 +74,16 @@ make install
Run Code-Preloader with the following command-line options: Run Code-Preloader with the following command-line options:
``` ```
Usage: code-preloader [options] ROOT_DIR CodePreloader v0.1.0
-c CONFIG_FILE, --config=CONFIG_FILE Usage: code-preloader [options] DIR ...
Load parameters from CONFIG_FILE
-i REGEX, --ignore=REGEX Options:
Ignore file or directory matching REGEX -c FILE, --config=FILE Load parameters from FILE
-o OUTPUT_FILE, --output=OUTPUT_FILE -i REGEXP, --ignore=REGEXP Ignore file or directory
Write output to OUTPUT_FILE -o FILE, --output=FILE Write output to FILE
-H HEADER_PROMPT_FILE, --header-prompt=HEADER_PROMPT_FILE -H FILE, --header-prompt=FILE Load header prompt from FILE
Load header prompt from HEADER_PROMPT_FILE -F FILE, --footer-prompt=FILE Load footer prompt from FILE
-F FOOTER_PROMPT_FILE, --footer-prompt=FOOTER_PROMPT_FILE --version Show version
Load footer prompt from FOOTER_PROMPT_FILE
-h, --help Show this help -h, --help Show this help
``` ```

View file

@ -17,44 +17,48 @@ module CodePreloader
def parse_arguments(args : Array(String)) def parse_arguments(args : Array(String))
OptionParser.parse(args) do |parser| OptionParser.parse(args) do |parser|
parser.banner = "Usage: code-preloader [options] DIR1 ..." parser.banner = [
"#{PROGRAM_NAME} v#{VERSION}",
"Usage: code-preloader [options] DIR ...\n",
"Options:"
].join("\n")
parser.on( parser.on(
"-c CONFIG_FILE", "-c FILE",
"--config=CONFIG_FILE", "--config=FILE",
"Load parameters from CONFIG_FILE" "Load parameters from FILE"
) do |config_file| ) do |config_file|
load_config(config_file) load_config(config_file)
end end
parser.on( parser.on(
"-i IGNORE_PATH", "-i REGEXP",
"--ignore=IGNORE_PATH", "--ignore=REGEXP",
"Ignore file or directory" "Ignore file or directory"
) do |ignore_file| ) do |ignore_file|
@ignore_list << ignore_file @ignore_list << ignore_file
end end
parser.on( parser.on(
"-o OUTPUT_FILE", "-o FILE",
"--output=OUTPUT_FILE", "--output=FILE",
"Write output to OUTPUT_FILE" "Write output to FILE"
) do |output_file| ) do |output_file|
@output_file_path = output_file @output_file_path = output_file
end end
parser.on( parser.on(
"-H HEADER_PROMPT_FILE", "-H FILE",
"--header-prompt=HEADER_PROMPT_FILE", "--header-prompt=FILE",
"Load header prompt from HEADER_PROMPT_FILE" "Load header prompt from FILE"
) do |header_prompt_file| ) do |header_prompt_file|
@header_prompt_file_path = header_prompt_file @header_prompt_file_path = header_prompt_file
end end
parser.on( parser.on(
"-F FOOTER_PROMPT_FILE", "-F FILE",
"--footer-prompt=FOOTER_PROMPT_FILE", "--footer-prompt=FILE",
"Load footer prompt from FOOTER_PROMPT_FILE" "Load footer prompt from FILE"
) do |footer_prompt_file| ) do |footer_prompt_file|
@footer_prompt_file_path = footer_prompt_file @footer_prompt_file_path = footer_prompt_file
end end