-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
The "bare double dash", or "--" is often used in unix commands to signify the end of named arguments, after which all arguments are treated as positional.
The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02
However, WP-CLI doesn't seem to handle the double dash correctly - instead, it treats it as a positional argument and still parses subsequent args as named.
Describe how other contributors can replicate this bug
Try these two commands, which would be expected to have distinct results:
$ wp option get home --require=/blah
Error: Required file 'blah' doesn't exist (from runtime argument).
$ wp option get home -- --require=/blah
Error: Required file 'blah' doesn't exist (from runtime argument).
Or this one, which should have worked:
$ wp option -- get home
Error: '--' is not a registered subcommand of 'option'. See 'wp help option' for available subcommands.
Describe what you expect as the correct outcome
When running $ wp option get home -- --require=/blah
, I would have expected the --require
parameter to be treated as a positional argument instead of a being parsed into a the named global parameter.
With $ wp option -- get home
, The double dash should have been ignored, resulting in effectively wp option get home
being run.
Let us know what environment you are running this on
OS: Linux 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64
Shell:
PHP binary: /usr/local/bin/php
PHP version: 7.2.14
php.ini used: /usr/local/etc/php/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /var/www/html
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config: /var/www/html/wp-cli.local.yml
WP-CLI version: 2.2.0