Skip to content

Instantly share code, notes, and snippets.

@MarcoNicolodi
Last active January 27, 2019 14:18
Show Gist options
  • Save MarcoNicolodi/cf82540c38b0e7b18b0c2aabb3f8f304 to your computer and use it in GitHub Desktop.
Save MarcoNicolodi/cf82540c38b0e7b18b0c2aabb3f8f304 to your computer and use it in GitHub Desktop.
const chooseFile = async ({ directory, message }) => {
const candidateFiles = await filesystem.list(directory)
const promptConfig = {
name: 'chosenFile',
message,
choices: ['all', prompt.separator(), ...candidateFiles]
}
const { chosenFile } = await prompt.ask(promptConfig)
return chosenFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment