-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(dev-env): add quiet mode for "import sql" #1615
Conversation
@yolih
|
@sjinks Would a flag that controls ES reindexing ( Alternatively, we could make reindexing the default and introduce a |
@chriszarate I have just added the So,
|
I'm not quite seeing the value of
This appears to have been left out, which is a good choice IMO. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In brief, --quiet is the same as --no-skip-reindex with informational messages hidden.
I get that, but this behavior is hidden and not apparent from the help text. If I were writing automations using vip
, I would certainly want a way to suppress interactivity.
But more importantly I would want clear, documented flags that let me completely control the behavior of the command. In other words, any interactive prompt should have a corresponding flag that lets me select all possible choices non-interactively.
I like this resource and its principles:
Only use prompts or interactive elements if stdin is an interactive terminal (a TTY). This is a pretty reliable way to tell whether you’re piping data into a command or whether it’s being run in a script, in which case a prompt won’t work and you should throw an error telling the user what flag to pass.
At any rate, I don't want to stand in the way of overall improvement, so the PR is approved and I'll let you decide the path forward.
315a963
to
de04693
Compare
@@ -25,9 +28,9 @@ export class DevEnvImportSQLCommand { | |||
this.slug = slug; | |||
} | |||
|
|||
async run( silent = false ) { | |||
async run() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna be an issue:
vip-cli/src/commands/dev-env-sync-sql.js
Lines 177 to 182 in 054cd85
const importOptions = { | |
inPlace: true, | |
skipValidate: true, | |
}; | |
const importCommand = new DevEnvImportSQLCommand( this.sqlFile, importOptions, this.slug ); | |
await importCommand.run( true ); |
Also, I'd prefer keeping the silent
parameter because it can be useful in re-purposing a command class in multiple places. I think all the command-classes' run
functions have this, for this purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated dev-env-sync-sql.js
to pass quiet: true
in the constructor's parameters.
This is because, with VIP CLI Express, we won't be able to pass arbitrary arguments to run()
. The correct approach will be to instantiate the command with the necessary parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run
function is being called from the dev-env-sync command with silent=true. Likely will break stuffs.
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the issue!
Description
Related: #1561
This PR adds:
--skip-reindex
flag to disable reindexing (like other boolean options, it can be negated to request reindexing:--no-skip-reindex explicitly
). The default is to reindex if the WP CLIvip-search
command is available;--quiet
flag to suppress extra output from the script (in addition, in this mode,--quiet
is passed to WP CLI, and--silent
is passed tomysql
).These options can be combined together.
Pull request checklist
New release checklist
Steps to Test
See #1561