项目作者: ORESoftware

项目描述 :
Because the unix `find` command sucks horribly.
高级语言: TypeScript
项目地址: git://github.com/ORESoftware/waldo.git
创建时间: 2018-05-08T17:55:25Z
项目社区:https://github.com/ORESoftware/waldo

开源协议:MIT License

下载


@oresoftware/waldo

GNU/BSD find kills me sometimes, so I wrote this.

install:

  1. # for command line tools
  2. npm install -g waldo
  3. # for library usage
  4. npm install waldo --save

At the command line:

Basic usage
  1. waldo ### lists all matching files and dirs in the current working dir
  1. waldo --path="." ### lists all matching files and dirs, in the current working dir

Note that if you omit the —path arg, it defaults to $PWD/.

  1. waldo --path="." --dirs ### will not list dirs, -d for short
  1. waldo --path="." --files ### will not list files, -f for short
  1. waldo --path="." --symlinks ### will not list symlinks, -s for short
Using matching
  1. waldo --path="." -n /node_modules/ # don't match any path that has /node_modules/ in it
  2. waldo --path="." -n ^/node_modules/ # don't match any path that starts with /node_modules/
  3. waldo --path="." -n '\.js$' # don't match any path ends that with '.js'
  4. waldo --path="." -m '\.js$' # match only paths that end that with '.js'

Library Usage

  1. import {WaldoSearch} from '@oresoftware/waldo';
  2. new WaldoSearch({
  3. path, // the path you which to search
  4. matchesAnyOf, // array of strings or RegExp
  5. matchesNoneOf, // array of strings or RegExp
  6. dirs, // list dirs
  7. files // list files (true by default)
  8. })
  9. .search((err, results) => {
  10. // results is your array of strings
  11. });

to use with ES6 Promises

=> Use the searchp() method
  1. new WaldoSearch({...}).searchp().then(results => {
  2. // results is your array of strings
  3. });