Last active
January 27, 2019 14:14
-
-
Save MarcoNicolodi/4e4941deccfa28a5ac8863a9e3ed8769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useChooseFile(finder) { | |
return function({ directory, message, matching }) { | |
const candidateFiles = await finder({ directory, matching }) | |
const promptOptions = { | |
name: 'chosenFile', | |
message, | |
choices: ['all', prompt.separator(), ...candidateFiles] | |
} | |
const { chosenFile } = await prompt.ask(promptOptions) | |
return chosenFile | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment