Allows for the selection of files via the command line
npm install select-files-cli>A library designed for selecting one or more files via the command line
``javascript
const { selectFiles } = require('select-files-cli');
selectFiles().then(({ selectedFiles, status }) => {
console.log(selectedFiles);
// [
// '/Users/sam/Documents/select-files-cli/README.md',
// '/Users/sam/Documents/select-files-cli/index.js'
// ]
console.log(status);
// 'SELECTION_COMPLETED' (or 'SELECTION_CANCELLED')
});
`
src="https://github.com/swseverance/select-files-cli/raw/master/cli.png" alt="select-files-cli">
`javascript`
selectFiles(options).then(...);
* pageSize: int10
* Default value is multi
* : booleantrue
* Defaults to to allow for selection of multiple filesselectedFiles
* : string[]clearConsole
* Files that will initially be selected
* : booleantrue
* Defaults to startingPath
* : stringprocess.cwd()
* Where the user will initially be prompted to select files
* Defaults to root
* : stringprocess.cwd()
* The top level directory the user has access to
* Defaults to directoryFilter
* : function => booleanfalse
* Return for any directory that you do not want to appear in the cli`javascript`
directoryFilter: (directoryName) => {
return !/node_modules$/gi.test(directoryName);
},fileFilter
* : function => booleanfalse
* Return for any file that you do not want to appear in the cli`javascript``
fileFilter: (fileName) => {
return !/index.js$/gi.test(fileName);
},
MIT