CLI helper for globing arguments
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
README.md
cli.js
index.d.ts
index.js
package.json

README.md

glob-args

Simple utility for parsing CLI globs. Matched files can be quoted, unmatched patterns will be returned unchanged. Uses glob, so on Windows use test/*.js not test\*.js.

Usage

const globArgs = require('glob-args')
const globbed = globArgs(['--option', '*/*.js'])
// globbed: ['--options', 'test/test.js', 'test/test2.js', etc]

You can pass optional { escape: true } - it will escape matched files:

const globbed = globArgs(['--option', '*/*.js'], { escape: true })
// globbed: ['--options', '"test/test.js"', '"test/test2.js"', etc]

Especially useful for all those apps that do not support globing. E.g., running:

glob-args some-app --v test/*.js

will execute some-app --v "test/test.js" "test/test2.js".