Skip to content

Commit

Permalink
Update section on help generation in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMagician23 committed Dec 13, 2023
1 parent 222e104 commit e0466fc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ See the examples under the `examples/` directory.

See http://lua-cliargs.netlify.com/ for the API docs.

## Help listings `--help`

A help listing will be automatically generated and accessed using the `--help` argument. When such an option is encountered, `cli:parse()` will abort and return `nil, string` with the help message; you are free to print it to the screen using `print()` if you want.

You can also force its display in the code using `cli:print_help()`.

This is the result for our example (see `examples/00_general.lua`):
## Help Listings

The library contains code to automatically generate help and usage text for all of the specified options and flags registered with the library; users should use the `cli:print_help()` function to generate it.
Here is some sample output of this code (see `examples/00_general.lua` to see where these specific options are defined):
```
Usage: cli_example.lua [OPTIONS] INPUT [OUTPUT-1 [OUTPUT-2 [...]]]
Expand All @@ -46,6 +42,8 @@ OPTIONS:
--verbose the script output will be very verbose
```

This code can be used to specify a `-h/--help` option, see `examples/05_help.lua` for an example of how this can be done.

## Validations

### Runtime argument validation
Expand Down

0 comments on commit e0466fc

Please sign in to comment.