Skip to content

Conversation

@RobSanders
Copy link
Collaborator

From changelog in libcli.spec....

  • Minor cosmetic change to how help messages are generated, minor edits
    to some comments, minor cosmetic change to clitest demo code
  • Tweak to buildmode to only show optargs 'after' the point at
    which buildmode was entered.
  • Add new 'cli_dump_optargs_and_args() function for development/debug
    Designed to be called from a callback to show output of optarg and
    argument processing.
  • Updated CLI_CMD_OPTIONAL_FLAG parsing to use an validator function
    (if provided) to determine if the word being looked is a match for
    the optional flag. If no validator function is provided then the
    word much match the name of the optional flag exactly.
  • Enhance how cli_parse_line handles quotes when parsine the command
    line. This includs mixed single/double quotes, embedded quoted
    substrings, and handling 'escaped' quotes using the '' character.
  • Ensure that buildmode preserves 'empty' strings
    (ex: "", or '') when regenerating the cmdline after the user 'executes'
    the command.

Rob Sanders added 7 commits November 14, 2019 13:41
…eserving quoted strings

- cli_parse_line now handles mixed quotes, escaped quotes, and treats a non-escaped, non-internal
  quote as a word boundary like a space/pipe/end-of-string
- buildmode will preserve any string with space, quotes, or empty string by wrapping it in
  an appropriate quote pair when rebuilding the commandline to be executed
- If a CLI_CMD_OPTIONAL_FLAG optarg does not have a validator then the word being examined
  must match the name of the flag exactly
- If a CLI_CMD_OPTIONAL_FLAG optarg does have a validator, then the validator must return
  CLI_OK for that to be a match

Example - given a pseudosyntax 'CMD [verbose] ARG1' where verbose is the OPTIONAL FLAG then
  the text 'CMD ARG1' and 'CMD verbose ARG1' would match, but 'CMD VERBOSE ARG1' would not.

If the OPTIONAL FLAG had a validator that did a strcasecmp with 'verbose' then it would match.

The validator also allows this syntax:
  'CMD [INTVAL] FOO' *if* the validator for INTVAL was written to return CLI_OK if the text
  for INTVAL was an integer
@RobSanders RobSanders closed this Feb 21, 2020
@RobSanders RobSanders reopened this Feb 21, 2020
@RobSanders RobSanders merged commit 1d3d6ed into stable Feb 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the V1.10.3 branch February 27, 2020 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants