Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp-env: run cli command misses the options passed with hyphens #32929

Closed
Nikschavan opened this issue Jun 23, 2021 · 5 comments · Fixed by #41179
Closed

wp-env: run cli command misses the options passed with hyphens #32929

Nikschavan opened this issue Jun 23, 2021 · 5 comments · Fixed by #41179
Assignees
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Env /packages/env [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers

Comments

@Nikschavan
Copy link
Contributor

Description

Any wp-env run cli commands with -- flags ignore the extra flags, For eg wp plugin install <plugin> --activate will ignore the activate flag -

> $ npm run wp-env run cli wp plugin install gutenberg --activate

> astra@3.6.2 wp-env /Users/Nik/Projects/wpcore/app/public/wp-content/themes/astra
> wp-env "run" "cli" "wp" "plugin" "install" "gutenberg"

⠋ /Users/Nik/Projects/wpcore/app/public/wp-content/themes/astra/.wp-env.json
9c90d286a625a650e4f4ef94e6a9344b
/Users/Nik/.wp-env/9c90d286a625a650e4f4ef94e6a9344b
ℹ Starting 'wp plugin install gutenberg' on the cli container.

Creating 9c90d286a625a650e4f4ef94e6a9344b_cli_run ... done
Warning: gutenberg: Plugin already installed.
Success: Plugin already installed.
✔ Ran `wp plugin install gutenberg` in 'cli'. (in 4s 724ms)

Also tried passing -- separately which did at first recognise the --activate flag but does not actually run it -

> $ npm run wp-env run cli wp plugin install gutenberg -- --activate

> astra@3.6.2 wp-env /Users/Nik/Projects/wpcore/app/public/wp-content/themes/astra
> wp-env "run" "cli" "wp" "plugin" "install" "gutenberg" "--activate"

ℹ Starting 'wp plugin install gutenberg' on the cli container.

Creating 9c90d286a625a650e4f4ef94e6a9344b_cli_run ... done
Installing Gutenberg (10.8.2)
Warning: Failed to create directory '/etc/X11/fs/.wp-cli/cache/': mkdir(): Permission denied.
Downloading installation package from https://downloads.wordpress.org/plugin/gutenberg.10.8.2.zip...
The authenticity of gutenberg.10.8.2.zip could not be verified as no signature was found.
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.
✔ Ran `wp plugin install gutenberg` in 'cli'. (in 13s 542ms)

Step-by-step reproduction instructions

In #32784 (comment) I also noticed that it is missing the -e flag, so probably - or -- both flags are not being passed forward to docker.

Expected behaviour

  • The executed commands run as expected.

Actual behaviour

  • The commands that are run in the container ignore the flags - and --

Screenshots or screen recording (optional)

Code snippet (optional)

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version:
  • Are all plugins except Gutenberg deactivated?
  • Are you using a default theme (e.g. Twenty Twenty-One)?

Device information

  • Device: MacBook Pro
  • Operating system: MacOS 11.4
  • Browser:
@Mamaduka
Copy link
Member

It might be related to #30466.

@Mamaduka Mamaduka added [Package] Env /packages/env Needs Testing Needs further testing to be confirmed. labels Jun 24, 2021
@Luehrsen
Copy link
Contributor

> $ npm run wp-env run cli "wp plugin install gutenberg --activate"

Wrapping the command in quotation marks usually does the trick.

@Mamaduka
Copy link
Member

Hello, @Nikschavan

As @Luehrsen mentioned, wrapping command in quotation marks is required in similar cases.

The wp-env run commands help texts mentions this, but it's easy to miss.

I'm going to label this as a documentation issue.

Thanks for bringing this up.

@Mamaduka Mamaduka added [Type] Developer Documentation Documentation for developers Good First Issue An issue that's suitable for someone looking to contribute for the first time and removed Needs Testing Needs further testing to be confirmed. labels Sep 14, 2021
@francisei
Copy link
Contributor

Hi, first time contributor, and happy to update the doc for this issue. But I don't see how to assign this issue to myself. Is this a permission issue?

@Mamaduka
Copy link
Member

Thanks for contributing, @francisei. I'm going to assign the issue to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Env /packages/env [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants