Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

REPL Help

Find package REPL help files.

Usage

var findREPLHelp = require( '@stdlib/_tools/pkgs/repl-help' );

findREPLHelp( [options,] clbk )

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 with package.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' ) );
}

findREPLHelp.sync( [options] )

Synchronously searches for package REPL help files.

var files = findREPLHelp.sync();
// returns [...]

The function accepts the same options as findREPLHelp() above.

Examples

var findREPLHelp = require( '@stdlib/_tools/pkgs/repl-help' );

findREPLHelp( onFiles );

function onFiles( error, files ) {
    if ( error ) {
        throw error;
    }
    console.log( files.join( '\n' ) );
}

CLI

Usage

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.

Notes

  • If not provided a dir argument, the current working directory is the search directory.

  • To provide multiple exclusion glob patterns, set multiple --ignore option arguments.

    $ find-pkg-repl-help --ignore=node_modules/** --ignore=build/** --ignore=reports/**

Examples

$ find-pkg-repl-help
<filepath>
<filepath>
...