wp-cli
wp-cli copied to clipboard
Command less not available on the current machine
Bug Report
Describe the current, buggy behavior
Running wp-cli without any arguments tries to open less. This will not work if less is not installed.
Describe how other contributors can replicate this bug
- run
wp-cli
- wait a couple seconds
- it returns
sh: 1: less: not found
Describe what you expect as the correct outcome
Maybe a simple manual page like you would get with --help
Let us know what environment you are running this on Ubuntu Docker
OS: Linux 5.3.16-300.fc31.x86_64 #1 SMP Fri Dec 13 17:59:04 UTC 2019 x86_64
Shell:
PHP binary: /usr/local/bin/php
PHP version: 7.2.4
php.ini used:
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.yml
WP-CLI version: 2.4.0
Provide a possible solution
Provide additional context/screenshots
apt-get update && apt-get install less
The above command solved the issue to me
Well yeah. I mean I kind of get that. But it would be cool if less wasn't a dependency for this. Often docker containers don't come with less. POSIX operating systems usually come with more
, which would probaply a better alternative.
See: https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html
I didn't get around to test it at home yet, but the MR is ready in case one of the maintainers feels like testing it and merging it.
@dhalucario Unfortunately people who create docker images don't necessarily create them to be posix compliant Unix. Some of the popular minimal linux images don't have all of posix commands. For instance, ed
which is mandatory according to the document you post. It's not available in the popular minideb image
docker run --rm -it bitnami/minideb:bullseye bash -c 'which more'
docker run --rm -it bitnami/minideb:bullseye bash -c 'which ed'
As you would see ed
won't be found.
Setting "cat" as pager can be a work-around.
PAGER=cat wp-cli help
Honestly I'm confused why the default is to use any pager, or at least why any *nix-like system would default to one. Platforms with no pipes I guess I can see it - though I still think it should just be available but not the default.
this bug is old as me... 😵 anyway it's easily fixable... I have found a way that could be well extended, see: https://github.com/GSCloud/docker_wordpress/blob/master/cmd_extras.sh
this file is copied to the container when installing the container via Makefile and the executed inside check the install routine in the Makefile > https://github.com/GSCloud/docker_wordpress/blob/master/Makefile#L92
🎈🎈🎈