Find package REPL help files.
var findREPLHelp = require( '@stdlib/_tools/pkgs/repl-help' );Asynchronously searches for package REPL help files.
findREPLHelp( onFiles );
function onFiles( error, files ) {
if ( error ) {
throw error;
}
console.log( files.join( '\n' ) );
}The function accepts the following options:
- dir: root directory from which to search for package REPL help files. May be either an absolute path or a path relative to the current working directory. Default: current working directory.
- pattern: glob pattern used to find packages. Default:
'**/package.json'(note: pattern must end withpackage.json). - filename: REPL help filename. May include a directory prefix (relative to a package's directory). Default:
docs/repl.txt. - ignore: list of glob patterns used to exclude matches.
To search from an alternative directory, set the dir option.
var opts = {
'dir': '/foo/bar/baz'
};
findREPLHelp( opts, onFiles );
function onFiles( error, files ) {
if ( error ) {
throw error;
}
console.log( files.join( '\n' ) );
}To provide an alternative include filter, set the pattern option.
var opts = {
'pattern': '**/foo/**/package.json'
};
findREPLHelp( opts, onFiles );
function onFiles( error, files ) {
if ( error ) {
throw error;
}
console.log( files.join( '\n' ) );
}To exclude matches, set the ignore option.
var opts = {
'ignore': [
'node_modules/**',
'build/**',
'reports/**'
]
};
findREPLHelp( opts, onFiles );
function onFiles( error, files ) {
if ( error ) {
throw error;
}
console.log( files.join( '\n' ) );
}Synchronously searches for package REPL help files.
var files = findREPLHelp.sync();
// returns [...]The function accepts the same options as findREPLHelp() above.
var findREPLHelp = require( '@stdlib/_tools/pkgs/repl-help' );
findREPLHelp( onFiles );
function onFiles( error, files ) {
if ( error ) {
throw error;
}
console.log( files.join( '\n' ) );
}Usage: find-pkg-repl-help [options] [<dir>]
Options:
-h, --help Print this message.
-V, --version Print the package version.
--pattern pattern Inclusion glob pattern.
--ignore pattern Exclusion glob pattern.
--filename filename REPL help filename.
-
If not provided a
dirargument, the current working directory is the search directory. -
To provide multiple exclusion glob patterns, set multiple
--ignoreoption arguments.$ find-pkg-repl-help --ignore=node_modules/** --ignore=build/** --ignore=reports/**
$ find-pkg-repl-help
<filepath>
<filepath>
...