survey
survey copied to clipboard
Disable Editor prompt
I would like to disable the editor prompt. This does not currently seem to be available is that correct?
hey @shanestarcher-okta! I guess i'm a little confused what you mean, is disabling the prompt different from just not including it? If you are looking for a way to optionally skip some questions based on reponse values, we recommend handling it with multiple calls to survey.Ask
or survey.AskOne
.
Please let me know if this doesn't cover your usecase
@AlecAivazis the goal is during a cli to not prompt the user at all, but to drop directly into the edit mode.
So in this case I don't actually ever want to ask anything. I would prefer this just drop directly into a edit mode and not ask if the user wants to edit. We have a flag -i
that puts it into interactive mode.
if interactive {
prompt := &survey.Editor{
FileName: "*.md",
Message: "Would you like to make any changes",
AppendDefault: true,
HideDefault: true,
Default: str,
}
err := survey.AskOne(prompt, &str)
if err != nil {
return err
}
}
@shanestarcher-okta Wouldn't it make more sense to not call the survey at all then? Seems like calling $EDITOR
yourself is more preferable here
@jaredallard I could certainly do that, but as far as I know, it seems to fit into the concept of the survey. Which is giving the user interactive input and it's 99% already supported.
And I would essentially need to know caveats like this that Survey has already found - https://github.com/AlecAivazis/survey/blob/34c84b521b1ede46d3297a274a7104538c49f1e4/editor.go#L158