Skip to content

Show the full command after using the --prompt flag #4995

@johnbillion

Description

@johnbillion

Often when I'm using the terminal and I can't remember the exact argument names for a command, I'll use the --prompt flag. However, if I want to re-run the same command then there's no way to do that without going through all the prompts again.

It would be great if WP-CLI output the full command (excluding empty values) immediately before running it when the --prompt flag is used, in the same way that bash does when using historical reference commands such as !!. That way there's an easy reference to copy and paste.

This should be safe to do as the flag can only be used in interactive mode, so the output for a scripted command wouldn't change.

Example:

$ wp post list --prompt
1/4 [--<field>:
2/4 [--field=<field>]: title
3/4 [--fields=<fields>]:
4/4 [--format=<format>]: csv
wp post list --field=title --format=csv
Hello world!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions