Skip to content

[Request] disable flag for confirm #244

Open
@tylersayshi

Description

@tylersayshi

Is your feature request related to a problem? Please describe.

when using p.group I want to first ask for a folder name, then check if that folder exists, then confirm the user wants to overwrite the folder when it exists. If the folder does not yet exist, the confirm step should be skipped.

Describe the solution you'd like

a disable flag like this:

const results = await p.group({
  folder: () =>
    p.text({
      message: "Folder name",
    }),
  overwrites: ({ results }) =>
    p.confirm({
      message: `would you like to overwrite ${results.folder}?`,
      disable: !folderExists(results.folder),
    }),
});

Describe alternatives you've considered

Alternatively I can split into two groups, check in between each group and manually handle the cancel.

e.g.: https://github.com/dai-shi/waku/pull/1290/files

This is ok, but less nice. Maybe there is a better way to do what I am doing here altogether though... that would be nice.

Additional context

happy to help with a PR if this is an acceptable thing to add.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions