www.federated.computer/node_modules/yargs-parser/build/lib/yargs-parser.js
david@federated.company a1adfc8706 Initial commit...
new file:   archetypes/default.md
	new file:   config.toml
	new file:   content/about/_index.md
	new file:   content/access/_index.md
	new file:   content/background.jpg
	new file:   content/background.mp4
	new file:   content/blog/_index.md
	new file:   content/manifesto/_index.md
	new file:   content/posts/_index.md
	new file:   content/posts/apple-breaks-privacy.md
	new file:   content/posts/main_street_against_big_tech.md
	new file:   content/posts/template.md
	new file:   content/posts/what_is_done_with_personal_data.md
	new file:   content/projects/_index.md
	new file:   node_modules/.bin/nanoid
	new file:   node_modules/.bin/postcss
	new file:   node_modules/.package-lock.json
	new file:   node_modules/@nodelib/fs.scandir/LICENSE
	new file:   node_modules/@nodelib/fs.scandir/README.md
	new file:   node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/adapters/fs.js
	new file:   node_modules/@nodelib/fs.scandir/out/constants.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/constants.js
	new file:   node_modules/@nodelib/fs.scandir/out/index.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/index.js
	new file:   node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/providers/async.js
	new file:   node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/providers/common.js
	new file:   node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/providers/sync.js
	new file:   node_modules/@nodelib/fs.scandir/out/settings.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/settings.js
	new file:   node_modules/@nodelib/fs.scandir/out/types/index.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/types/index.js
	new file:   node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/utils/fs.js
	new file:   node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
	new file:   node_modules/@nodelib/fs.scandir/out/utils/index.js
	new file:   node_modules/@nodelib/fs.scandir/package.json
	new file:   node_modules/@nodelib/fs.stat/LICENSE
	new file:   node_modules/@nodelib/fs.stat/README.md
	new file:   node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/adapters/fs.js
	new file:   node_modules/@nodelib/fs.stat/out/index.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/index.js
	new file:   node_modules/@nodelib/fs.stat/out/providers/async.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/providers/async.js
	new file:   node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/providers/sync.js
	new file:   node_modules/@nodelib/fs.stat/out/settings.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/settings.js
	new file:   node_modules/@nodelib/fs.stat/out/types/index.d.ts
	new file:   node_modules/@nodelib/fs.stat/out/types/index.js
	new file:   node_modules/@nodelib/fs.stat/package.json
	new file:   node_modules/@nodelib/fs.walk/LICENSE
	new file:   node_modules/@nodelib/fs.walk/README.md
	new file:   node_modules/@nodelib/fs.walk/out/index.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/index.js
	new file:   node_modules/@nodelib/fs.walk/out/providers/async.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/providers/async.js
	new file:   node_modules/@nodelib/fs.walk/out/providers/index.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/providers/index.js
	new file:   node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/providers/stream.js
	new file:   node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/providers/sync.js
	new file:   node_modules/@nodelib/fs.walk/out/readers/async.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/readers/async.js
	new file:   node_modules/@nodelib/fs.walk/out/readers/common.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/readers/common.js
	new file:   node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/readers/reader.js
	new file:   node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/readers/sync.js
	new file:   node_modules/@nodelib/fs.walk/out/settings.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/settings.js
	new file:   node_modules/@nodelib/fs.walk/out/types/index.d.ts
	new file:   node_modules/@nodelib/fs.walk/out/types/index.js
	new file:   node_modules/@nodelib/fs.walk/package.json
	new file:   node_modules/ansi-regex/index.d.ts
	new file:   node_modules/ansi-regex/index.js
	new file:   node_modules/ansi-regex/license
	new file:   node_modules/ansi-regex/package.json
	new file:   node_modules/ansi-regex/readme.md
	new file:   node_modules/ansi-styles/index.d.ts
	new file:   node_modules/ansi-styles/index.js
	new file:   node_modules/ansi-styles/license
	new file:   node_modules/ansi-styles/package.json
	new file:   node_modules/ansi-styles/readme.md
	new file:   node_modules/anymatch/LICENSE
	new file:   node_modules/anymatch/README.md
	new file:   node_modules/anymatch/index.d.ts
	new file:   node_modules/anymatch/index.js
	new file:   node_modules/anymatch/package.json
	new file:   node_modules/array-union/index.d.ts
	new file:   node_modules/array-union/index.js
	new file:   node_modules/array-union/license
	new file:   node_modules/array-union/package.json
	new file:   node_modules/array-union/readme.md
	new file:   node_modules/binary-extensions/binary-extensions.json
	new file:   node_modules/binary-extensions/binary-extensions.json.d.ts
	new file:   node_modules/binary-extensions/index.d.ts
	new file:   node_modules/binary-extensions/index.js
	new file:   node_modules/binary-extensions/license
	new file:   node_modules/binary-extensions/package.json
	new file:   node_modules/binary-extensions/readme.md
	new file:   node_modules/braces/CHANGELOG.md
	new file:   node_modules/braces/LICENSE
	new file:   node_modules/braces/README.md
	new file:   node_modules/braces/index.js
	new file:   node_modules/braces/lib/compile.js
	new file:   node_modules/braces/lib/constants.js
	new file:   node_modules/braces/lib/expand.js
	new file:   node_modules/braces/lib/parse.js
	new file:   node_modules/braces/lib/stringify.js
	new file:   node_modules/braces/lib/utils.js
	new file:   node_modules/braces/package.json
	new file:   node_modules/chokidar/LICENSE
	new file:   node_modules/chokidar/README.md
	new file:   node_modules/chokidar/index.js
	new file:   node_modules/chokidar/lib/constants.js
	new file:   node_modules/chokidar/lib/fsevents-handler.js
	new file:   node_modules/chokidar/lib/nodefs-handler.js
	new file:   node_modules/chokidar/package.json
	new file:   node_modules/chokidar/types/index.d.ts
	new file:   node_modules/cliui/CHANGELOG.md
	new file:   node_modules/cliui/LICENSE.txt
	new file:   node_modules/cliui/README.md
	new file:   node_modules/cliui/build/index.cjs
	new file:   node_modules/cliui/build/lib/index.js
	new file:   node_modules/cliui/build/lib/string-utils.js
	new file:   node_modules/cliui/index.mjs
	new file:   node_modules/cliui/package.json
	new file:   node_modules/color-convert/CHANGELOG.md
	new file:   node_modules/color-convert/LICENSE
	new file:   node_modules/color-convert/README.md
	new file:   node_modules/color-convert/conversions.js
	new file:   node_modules/color-convert/index.js
	new file:   node_modules/color-convert/package.json
	new file:   node_modules/color-convert/route.js
	new file:   node_modules/color-name/LICENSE
	new file:   node_modules/color-name/README.md
	new file:   node_modules/color-name/index.js
	new file:   node_modules/color-name/package.json
	new file:   node_modules/dependency-graph/CHANGELOG.md
	new file:   node_modules/dependency-graph/LICENSE
	new file:   node_modules/dependency-graph/README.md
	new file:   node_modules/dependency-graph/lib/dep_graph.js
	new file:   node_modules/dependency-graph/lib/index.d.ts
	new file:   node_modules/dependency-graph/package.json
	new file:   node_modules/dependency-graph/specs/dep_graph_spec.js
	new file:   node_modules/dir-glob/index.js
	new file:   node_modules/dir-glob/license
	new file:   node_modules/dir-glob/package.json
	new file:   node_modules/dir-glob/readme.md
	new file:   node_modules/emoji-regex/LICENSE-MIT.txt
	new file:   node_modules/emoji-regex/README.md
	new file:   node_modules/emoji-regex/es2015/index.js
	new file:   node_modules/emoji-regex/es2015/text.js
	new file:   node_modules/emoji-regex/index.d.ts
	new file:   node_modules/emoji-regex/index.js
	new file:   node_modules/emoji-regex/package.json
	new file:   node_modules/emoji-regex/text.js
	new file:   node_modules/escalade/dist/index.js
	new file:   node_modules/escalade/dist/index.mjs
	new file:   node_modules/escalade/index.d.ts
	new file:   node_modules/escalade/license
	new file:   node_modules/escalade/package.json
	new file:   node_modules/escalade/readme.md
	new file:   node_modules/escalade/sync/index.d.ts
	new file:   node_modules/escalade/sync/index.js
	new file:   node_modules/escalade/sync/index.mjs
	new file:   node_modules/fast-glob/LICENSE
	new file:   node_modules/fast-glob/README.md
	new file:   node_modules/fast-glob/out/index.d.ts
	new file:   node_modules/fast-glob/out/index.js
	new file:   node_modules/fast-glob/out/managers/patterns.d.ts
	new file:   node_modules/fast-glob/out/managers/patterns.js
	new file:   node_modules/fast-glob/out/managers/tasks.d.ts
	new file:   node_modules/fast-glob/out/managers/tasks.js
	new file:   node_modules/fast-glob/out/providers/async.d.ts
	new file:   node_modules/fast-glob/out/providers/async.js
	new file:   node_modules/fast-glob/out/providers/filters/deep.d.ts
	new file:   node_modules/fast-glob/out/providers/filters/deep.js
	new file:   node_modules/fast-glob/out/providers/filters/entry.d.ts
	new file:   node_modules/fast-glob/out/providers/filters/entry.js
	new file:   node_modules/fast-glob/out/providers/filters/error.d.ts
	new file:   node_modules/fast-glob/out/providers/filters/error.js
	new file:   node_modules/fast-glob/out/providers/matchers/matcher.d.ts
	new file:   node_modules/fast-glob/out/providers/matchers/matcher.js
	new file:   node_modules/fast-glob/out/providers/matchers/partial.d.ts
	new file:   node_modules/fast-glob/out/providers/matchers/partial.js
	new file:   node_modules/fast-glob/out/providers/provider.d.ts
	new file:   node_modules/fast-glob/out/providers/provider.js
	new file:   node_modules/fast-glob/out/providers/stream.d.ts
	new file:   node_modules/fast-glob/out/providers/stream.js
	new file:   node_modules/fast-glob/out/providers/sync.d.ts
	new file:   node_modules/fast-glob/out/providers/sync.js
	new file:   node_modules/fast-glob/out/providers/transformers/entry.d.ts
	new file:   node_modules/fast-glob/out/providers/transformers/entry.js
	new file:   node_modules/fast-glob/out/readers/reader.d.ts
	new file:   node_modules/fast-glob/out/readers/reader.js
	new file:   node_modules/fast-glob/out/readers/stream.d.ts
	new file:   node_modules/fast-glob/out/readers/stream.js
	new file:   node_modules/fast-glob/out/readers/sync.d.ts
	new file:   node_modules/fast-glob/out/readers/sync.js
	new file:   node_modules/fast-glob/out/settings.d.ts
	new file:   node_modules/fast-glob/out/settings.js
	new file:   node_modules/fast-glob/out/types/index.d.ts
	new file:   node_modules/fast-glob/out/types/index.js
	new file:   node_modules/fast-glob/out/utils/array.d.ts
	new file:   node_modules/fast-glob/out/utils/array.js
	new file:   node_modules/fast-glob/out/utils/errno.d.ts
	new file:   node_modules/fast-glob/out/utils/errno.js
	new file:   node_modules/fast-glob/out/utils/fs.d.ts
	new file:   node_modules/fast-glob/out/utils/fs.js
	new file:   node_modules/fast-glob/out/utils/index.d.ts
	new file:   node_modules/fast-glob/out/utils/index.js
	new file:   node_modules/fast-glob/out/utils/path.d.ts
	new file:   node_modules/fast-glob/out/utils/path.js
	new file:   node_modules/fast-glob/out/utils/pattern.d.ts
	new file:   node_modules/fast-glob/out/utils/pattern.js
	new file:   node_modules/fast-glob/out/utils/stream.d.ts
	new file:   node_modules/fast-glob/out/utils/stream.js
	new file:   node_modules/fast-glob/out/utils/string.d.ts
	new file:   node_modules/fast-glob/out/utils/string.js
	new file:   node_modules/fast-glob/package.json
	new file:   node_modules/fastq/.github/dependabot.yml
	new file:   node_modules/fastq/.github/workflows/ci.yml
	new file:   node_modules/fastq/LICENSE
	new file:   node_modules/fastq/README.md
	new file:   node_modules/fastq/bench.js
	new file:   node_modules/fastq/example.js
	new file:   node_modules/fastq/example.mjs
	new file:   node_modules/fastq/index.d.ts
	new file:   node_modules/fastq/package.json
	new file:   node_modules/fastq/queue.js
	new file:   node_modules/fastq/test/example.ts
	new file:   node_modules/fastq/test/promise.js
	new file:   node_modules/fastq/test/test.js
	new file:   node_modules/fastq/test/tsconfig.json
	new file:   node_modules/fill-range/LICENSE
	new file:   node_modules/fill-range/README.md
	new file:   node_modules/fill-range/index.js
	new file:   node_modules/fill-range/package.json
	new file:   node_modules/fs-extra/CHANGELOG.md
	new file:   node_modules/fs-extra/LICENSE
	new file:   node_modules/fs-extra/README.md
	new file:   node_modules/fs-extra/lib/copy-sync/copy-sync.js
	new file:   node_modules/fs-extra/lib/copy-sync/index.js
	new file:   node_modules/fs-extra/lib/copy/copy.js
	new file:   node_modules/fs-extra/lib/copy/index.js
	new file:   node_modules/fs-extra/lib/empty/index.js
	new file:   node_modules/fs-extra/lib/ensure/file.js
	new file:   node_modules/fs-extra/lib/ensure/index.js
	new file:   node_modules/fs-extra/lib/ensure/link.js
	new file:   node_modules/fs-extra/lib/ensure/symlink-paths.js
	new file:   node_modules/fs-extra/lib/ensure/symlink-type.js
	new file:   node_modules/fs-extra/lib/ensure/symlink.js
	new file:   node_modules/fs-extra/lib/fs/index.js
	new file:   node_modules/fs-extra/lib/index.js
	new file:   node_modules/fs-extra/lib/json/index.js
	new file:   node_modules/fs-extra/lib/json/jsonfile.js
	new file:   node_modules/fs-extra/lib/json/output-json-sync.js
	new file:   node_modules/fs-extra/lib/json/output-json.js
	new file:   node_modules/fs-extra/lib/mkdirs/index.js
	new file:   node_modules/fs-extra/lib/mkdirs/make-dir.js
	new file:   node_modules/fs-extra/lib/mkdirs/utils.js
	new file:   node_modules/fs-extra/lib/move-sync/index.js
	new file:   node_modules/fs-extra/lib/move-sync/move-sync.js
	new file:   node_modules/fs-extra/lib/move/index.js
	new file:   node_modules/fs-extra/lib/move/move.js
	new file:   node_modules/fs-extra/lib/output/index.js
	new file:   node_modules/fs-extra/lib/path-exists/index.js
	new file:   node_modules/fs-extra/lib/remove/index.js
	new file:   node_modules/fs-extra/lib/remove/rimraf.js
	new file:   node_modules/fs-extra/lib/util/stat.js
	new file:   node_modules/fs-extra/lib/util/utimes.js
	new file:   node_modules/fs-extra/package.json
	new file:   node_modules/get-caller-file/LICENSE.md
	new file:   node_modules/get-caller-file/README.md
	new file:   node_modules/get-caller-file/index.d.ts
	new file:   node_modules/get-caller-file/index.js
	new file:   node_modules/get-caller-file/index.js.map
	new file:   node_modules/get-caller-file/package.json
	new file:   node_modules/get-stdin/index.d.ts
	new file:   node_modules/get-stdin/index.js
	new file:   node_modules/get-stdin/license
	new file:   node_modules/get-stdin/package.json
	new file:   node_modules/get-stdin/readme.md
	new file:   node_modules/glob-parent/CHANGELOG.md
	new file:   node_modules/glob-parent/LICENSE
	new file:   node_modules/glob-parent/README.md
	new file:   node_modules/glob-parent/index.js
	new file:   node_modules/glob-parent/package.json
	new file:   node_modules/globby/gitignore.js
	new file:   node_modules/globby/index.d.ts
	new file:   node_modules/globby/index.js
	new file:   node_modules/globby/license
	new file:   node_modules/globby/package.json
	new file:   node_modules/globby/readme.md
	new file:   node_modules/globby/stream-utils.js
	new file:   node_modules/globby/to-path.js
	new file:   node_modules/graceful-fs/LICENSE
	new file:   node_modules/graceful-fs/README.md
	new file:   node_modules/graceful-fs/clone.js
	new file:   node_modules/graceful-fs/graceful-fs.js
	new file:   node_modules/graceful-fs/legacy-streams.js
	new file:   node_modules/graceful-fs/package.json
	new file:   node_modules/graceful-fs/polyfills.js
	new file:   node_modules/ignore/LICENSE-MIT
	new file:   node_modules/ignore/README.md
	new file:   node_modules/ignore/index.d.ts
	new file:   node_modules/ignore/index.js
	new file:   node_modules/ignore/legacy.js
	new file:   node_modules/ignore/package.json
	new file:   node_modules/is-binary-path/index.d.ts
	new file:   node_modules/is-binary-path/index.js
	new file:   node_modules/is-binary-path/license
	new file:   node_modules/is-binary-path/package.json
	new file:   node_modules/is-binary-path/readme.md
	new file:   node_modules/is-extglob/LICENSE
	new file:   node_modules/is-extglob/README.md
	new file:   node_modules/is-extglob/index.js
	new file:   node_modules/is-extglob/package.json
	new file:   node_modules/is-fullwidth-code-point/index.d.ts
	new file:   node_modules/is-fullwidth-code-point/index.js
	new file:   node_modules/is-fullwidth-code-point/license
	new file:   node_modules/is-fullwidth-code-point/package.json
	new file:   node_modules/is-fullwidth-code-point/readme.md
	new file:   node_modules/is-glob/LICENSE
	new file:   node_modules/is-glob/README.md
	new file:   node_modules/is-glob/index.js
	new file:   node_modules/is-glob/package.json
	new file:   node_modules/is-number/LICENSE
	new file:   node_modules/is-number/README.md
	new file:   node_modules/is-number/index.js
	new file:   node_modules/is-number/package.json
	new file:   node_modules/jsonfile/CHANGELOG.md
	new file:   node_modules/jsonfile/LICENSE
	new file:   node_modules/jsonfile/README.md
	new file:   node_modules/jsonfile/index.js
	new file:   node_modules/jsonfile/package.json
	new file:   node_modules/jsonfile/utils.js
	new file:   node_modules/lilconfig/dist/index.d.ts
	new file:   node_modules/lilconfig/dist/index.js
	new file:   node_modules/lilconfig/package.json
	new file:   node_modules/lilconfig/readme.md
	new file:   node_modules/merge2/LICENSE
	new file:   node_modules/merge2/README.md
	new file:   node_modules/merge2/index.js
	new file:   node_modules/merge2/package.json
	new file:   node_modules/micromatch/CHANGELOG.md
	new file:   node_modules/micromatch/LICENSE
	new file:   node_modules/micromatch/README.md
	new file:   node_modules/micromatch/index.js
	new file:   node_modules/micromatch/package.json
	new file:   node_modules/nanoid/LICENSE
	new file:   node_modules/nanoid/README.md
	new file:   node_modules/nanoid/async/index.browser.cjs
	new file:   node_modules/nanoid/async/index.browser.js
	new file:   node_modules/nanoid/async/index.cjs
	new file:   node_modules/nanoid/async/index.d.ts
	new file:   node_modules/nanoid/async/index.js
	new file:   node_modules/nanoid/async/index.native.js
	new file:   node_modules/nanoid/async/package.json
	new file:   node_modules/nanoid/bin/nanoid.cjs
	new file:   node_modules/nanoid/index.browser.cjs
	new file:   node_modules/nanoid/index.browser.js
	new file:   node_modules/nanoid/index.cjs
	new file:   node_modules/nanoid/index.d.ts
	new file:   node_modules/nanoid/index.dev.js
	new file:   node_modules/nanoid/index.js
	new file:   node_modules/nanoid/index.prod.js
	new file:   node_modules/nanoid/nanoid.js
	new file:   node_modules/nanoid/non-secure/index.cjs
	new file:   node_modules/nanoid/non-secure/index.d.ts
	new file:   node_modules/nanoid/non-secure/index.js
	new file:   node_modules/nanoid/non-secure/package.json
	new file:   node_modules/nanoid/package.json
	new file:   node_modules/nanoid/url-alphabet/index.cjs
	new file:   node_modules/nanoid/url-alphabet/index.js
	new file:   node_modules/nanoid/url-alphabet/package.json
	new file:   node_modules/normalize-path/LICENSE
	new file:   node_modules/normalize-path/README.md
	new file:   node_modules/normalize-path/index.js
	new file:   node_modules/normalize-path/package.json
	new file:   node_modules/path-type/index.d.ts
	new file:   node_modules/path-type/index.js
	new file:   node_modules/path-type/license
	new file:   node_modules/path-type/package.json
	new file:   node_modules/path-type/readme.md
	new file:   node_modules/picocolors/LICENSE
	new file:   node_modules/picocolors/README.md
	new file:   node_modules/picocolors/package.json
	new file:   node_modules/picocolors/picocolors.browser.js
	new file:   node_modules/picocolors/picocolors.d.ts
	new file:   node_modules/picocolors/picocolors.js
	new file:   node_modules/picocolors/types.ts
	new file:   node_modules/picomatch/CHANGELOG.md
	new file:   node_modules/picomatch/LICENSE
	new file:   node_modules/picomatch/README.md
	new file:   node_modules/picomatch/index.js
	new file:   node_modules/picomatch/lib/constants.js
	new file:   node_modules/picomatch/lib/parse.js
	new file:   node_modules/picomatch/lib/picomatch.js
	new file:   node_modules/picomatch/lib/scan.js
	new file:   node_modules/picomatch/lib/utils.js
	new file:   node_modules/picomatch/package.json
	new file:   node_modules/pify/index.js
	new file:   node_modules/pify/license
	new file:   node_modules/pify/package.json
	new file:   node_modules/pify/readme.md
	new file:   node_modules/postcss-cli/LICENSE
	new file:   node_modules/postcss-cli/README.md
	new file:   node_modules/postcss-cli/index.js
	new file:   node_modules/postcss-cli/lib/DependencyGraph.js
	new file:   node_modules/postcss-cli/lib/args.js
	new file:   node_modules/postcss-cli/lib/getMapfile.js
	new file:   node_modules/postcss-cli/package.json
	new file:   node_modules/postcss-load-config/LICENSE
	new file:   node_modules/postcss-load-config/README.md
	new file:   node_modules/postcss-load-config/package.json
	new file:   node_modules/postcss-load-config/src/index.d.ts
	new file:   node_modules/postcss-load-config/src/index.js
	new file:   node_modules/postcss-load-config/src/options.js
	new file:   node_modules/postcss-load-config/src/plugins.js
	new file:   node_modules/postcss-load-config/src/req.js
	new file:   node_modules/postcss-reporter/LICENSE
	new file:   node_modules/postcss-reporter/README.md
	new file:   node_modules/postcss-reporter/index.js
	new file:   node_modules/postcss-reporter/lib/formatter.js
	new file:   node_modules/postcss-reporter/lib/reporter.js
	new file:   node_modules/postcss-reporter/lib/util.js
	new file:   node_modules/postcss-reporter/package.json
	new file:   node_modules/postcss/LICENSE
	new file:   node_modules/postcss/README.md
	new file:   node_modules/postcss/lib/at-rule.d.ts
	new file:   node_modules/postcss/lib/at-rule.js
	new file:   node_modules/postcss/lib/comment.d.ts
	new file:   node_modules/postcss/lib/comment.js
	new file:   node_modules/postcss/lib/container.d.ts
	new file:   node_modules/postcss/lib/container.js
	new file:   node_modules/postcss/lib/css-syntax-error.d.ts
	new file:   node_modules/postcss/lib/css-syntax-error.js
	new file:   node_modules/postcss/lib/declaration.d.ts
	new file:   node_modules/postcss/lib/declaration.js
	new file:   node_modules/postcss/lib/document.d.ts
	new file:   node_modules/postcss/lib/document.js
	new file:   node_modules/postcss/lib/fromJSON.d.ts
	new file:   node_modules/postcss/lib/fromJSON.js
	new file:   node_modules/postcss/lib/input.d.ts
	new file:   node_modules/postcss/lib/input.js
	new file:   node_modules/postcss/lib/lazy-result.d.ts
	new file:   node_modules/postcss/lib/lazy-result.js
	new file:   node_modules/postcss/lib/list.d.ts
	new file:   node_modules/postcss/lib/list.js
	new file:   node_modules/postcss/lib/map-generator.js
	new file:   node_modules/postcss/lib/no-work-result.d.ts
	new file:   node_modules/postcss/lib/no-work-result.js
	new file:   node_modules/postcss/lib/node.d.ts
	new file:   node_modules/postcss/lib/node.js
	new file:   node_modules/postcss/lib/parse.d.ts
	new file:   node_modules/postcss/lib/parse.js
	new file:   node_modules/postcss/lib/parser.js
	new file:   node_modules/postcss/lib/postcss.d.ts
	new file:   node_modules/postcss/lib/postcss.js
	new file:   node_modules/postcss/lib/postcss.mjs
	new file:   node_modules/postcss/lib/previous-map.d.ts
	new file:   node_modules/postcss/lib/previous-map.js
	new file:   node_modules/postcss/lib/processor.d.ts
	new file:   node_modules/postcss/lib/processor.js
	new file:   node_modules/postcss/lib/result.d.ts
	new file:   node_modules/postcss/lib/result.js
	new file:   node_modules/postcss/lib/root.d.ts
	new file:   node_modules/postcss/lib/root.js
	new file:   node_modules/postcss/lib/rule.d.ts
	new file:   node_modules/postcss/lib/rule.js
	new file:   node_modules/postcss/lib/stringifier.d.ts
	new file:   node_modules/postcss/lib/stringifier.js
	new file:   node_modules/postcss/lib/stringify.d.ts
	new file:   node_modules/postcss/lib/stringify.js
	new file:   node_modules/postcss/lib/symbols.js
	new file:   node_modules/postcss/lib/terminal-highlight.js
	new file:   node_modules/postcss/lib/tokenize.js
	new file:   node_modules/postcss/lib/warn-once.js
	new file:   node_modules/postcss/lib/warning.d.ts
	new file:   node_modules/postcss/lib/warning.js
	new file:   node_modules/postcss/package.json
	new file:   node_modules/pretty-hrtime/.jshintignore
	new file:   node_modules/pretty-hrtime/.npmignore
	new file:   node_modules/pretty-hrtime/LICENSE
	new file:   node_modules/pretty-hrtime/README.md
	new file:   node_modules/pretty-hrtime/index.js
	new file:   node_modules/pretty-hrtime/package.json
	new file:   node_modules/queue-microtask/LICENSE
	new file:   node_modules/queue-microtask/README.md
	new file:   node_modules/queue-microtask/index.d.ts
	new file:   node_modules/queue-microtask/index.js
	new file:   node_modules/queue-microtask/package.json
	new file:   node_modules/read-cache/LICENSE
	new file:   node_modules/read-cache/README.md
	new file:   node_modules/read-cache/index.js
	new file:   node_modules/read-cache/package.json
	new file:   node_modules/readdirp/LICENSE
	new file:   node_modules/readdirp/README.md
	new file:   node_modules/readdirp/index.d.ts
	new file:   node_modules/readdirp/index.js
	new file:   node_modules/readdirp/package.json
	new file:   node_modules/require-directory/.jshintrc
	new file:   node_modules/require-directory/.npmignore
	new file:   node_modules/require-directory/.travis.yml
	new file:   node_modules/require-directory/LICENSE
	new file:   node_modules/require-directory/README.markdown
	new file:   node_modules/require-directory/index.js
	new file:   node_modules/require-directory/package.json
	new file:   node_modules/reusify/.coveralls.yml
	new file:   node_modules/reusify/.travis.yml
	new file:   node_modules/reusify/LICENSE
	new file:   node_modules/reusify/README.md
	new file:   node_modules/reusify/benchmarks/createNoCodeFunction.js
	new file:   node_modules/reusify/benchmarks/fib.js
	new file:   node_modules/reusify/benchmarks/reuseNoCodeFunction.js
	new file:   node_modules/reusify/package.json
	new file:   node_modules/reusify/reusify.js
	new file:   node_modules/reusify/test.js
	new file:   node_modules/run-parallel/LICENSE
	new file:   node_modules/run-parallel/README.md
	new file:   node_modules/run-parallel/index.js
	new file:   node_modules/run-parallel/package.json
	new file:   node_modules/slash/index.d.ts
	new file:   node_modules/slash/index.js
	new file:   node_modules/slash/license
	new file:   node_modules/slash/package.json
	new file:   node_modules/slash/readme.md
	new file:   node_modules/source-map-js/CHANGELOG.md
	new file:   node_modules/source-map-js/LICENSE
	new file:   node_modules/source-map-js/README.md
	new file:   node_modules/source-map-js/lib/array-set.js
	new file:   node_modules/source-map-js/lib/base64-vlq.js
	new file:   node_modules/source-map-js/lib/base64.js
	new file:   node_modules/source-map-js/lib/binary-search.js
	new file:   node_modules/source-map-js/lib/mapping-list.js
	new file:   node_modules/source-map-js/lib/quick-sort.js
	new file:   node_modules/source-map-js/lib/source-map-consumer.js
	new file:   node_modules/source-map-js/lib/source-map-generator.js
	new file:   node_modules/source-map-js/lib/source-node.js
	new file:   node_modules/source-map-js/lib/util.js
	new file:   node_modules/source-map-js/package.json
	new file:   node_modules/source-map-js/source-map.d.ts
	new file:   node_modules/source-map-js/source-map.js
	new file:   node_modules/string-width/index.d.ts
	new file:   node_modules/string-width/index.js
	new file:   node_modules/string-width/license
	new file:   node_modules/string-width/package.json
	new file:   node_modules/string-width/readme.md
	new file:   node_modules/strip-ansi/index.d.ts
	new file:   node_modules/strip-ansi/index.js
	new file:   node_modules/strip-ansi/license
	new file:   node_modules/strip-ansi/package.json
	new file:   node_modules/strip-ansi/readme.md
	new file:   node_modules/thenby/LICENSE.TXT
	new file:   node_modules/thenby/README.md
	new file:   node_modules/thenby/package.json
	new file:   node_modules/thenby/thenBy.min.js
	new file:   node_modules/thenby/thenBy.module.d.ts
	new file:   node_modules/thenby/thenBy.module.js
	new file:   node_modules/to-regex-range/LICENSE
	new file:   node_modules/to-regex-range/README.md
	new file:   node_modules/to-regex-range/index.js
	new file:   node_modules/to-regex-range/package.json
	new file:   node_modules/universalify/LICENSE
	new file:   node_modules/universalify/README.md
	new file:   node_modules/universalify/index.js
	new file:   node_modules/universalify/package.json
	new file:   node_modules/wrap-ansi/index.js
	new file:   node_modules/wrap-ansi/license
	new file:   node_modules/wrap-ansi/package.json
	new file:   node_modules/wrap-ansi/readme.md
	new file:   node_modules/y18n/CHANGELOG.md
	new file:   node_modules/y18n/LICENSE
	new file:   node_modules/y18n/README.md
	new file:   node_modules/y18n/build/index.cjs
	new file:   node_modules/y18n/build/lib/cjs.js
	new file:   node_modules/y18n/build/lib/index.js
	new file:   node_modules/y18n/build/lib/platform-shims/node.js
	new file:   node_modules/y18n/index.mjs
	new file:   node_modules/y18n/package.json
	new file:   node_modules/yaml/LICENSE
	new file:   node_modules/yaml/README.md
	new file:   node_modules/yaml/browser/dist/PlainValue-b8036b75.js
	new file:   node_modules/yaml/browser/dist/Schema-e94716c8.js
	new file:   node_modules/yaml/browser/dist/index.js
	new file:   node_modules/yaml/browser/dist/legacy-exports.js
	new file:   node_modules/yaml/browser/dist/package.json
	new file:   node_modules/yaml/browser/dist/parse-cst.js
	new file:   node_modules/yaml/browser/dist/resolveSeq-492ab440.js
	new file:   node_modules/yaml/browser/dist/types.js
	new file:   node_modules/yaml/browser/dist/util.js
	new file:   node_modules/yaml/browser/dist/warnings-df54cb69.js
	new file:   node_modules/yaml/browser/index.js
	new file:   node_modules/yaml/browser/map.js
	new file:   node_modules/yaml/browser/pair.js
	new file:   node_modules/yaml/browser/parse-cst.js
	new file:   node_modules/yaml/browser/scalar.js
	new file:   node_modules/yaml/browser/schema.js
	new file:   node_modules/yaml/browser/seq.js
	new file:   node_modules/yaml/browser/types.js
	new file:   node_modules/yaml/browser/types/binary.js
	new file:   node_modules/yaml/browser/types/omap.js
	new file:   node_modules/yaml/browser/types/pairs.js
	new file:   node_modules/yaml/browser/types/set.js
	new file:   node_modules/yaml/browser/types/timestamp.js
	new file:   node_modules/yaml/browser/util.js
	new file:   node_modules/yaml/dist/Document-9b4560a1.js
	new file:   node_modules/yaml/dist/PlainValue-ec8e588e.js
	new file:   node_modules/yaml/dist/Schema-88e323a7.js
	new file:   node_modules/yaml/dist/index.js
	new file:   node_modules/yaml/dist/legacy-exports.js
	new file:   node_modules/yaml/dist/parse-cst.js
	new file:   node_modules/yaml/dist/resolveSeq-d03cb037.js
	new file:   node_modules/yaml/dist/test-events.js
	new file:   node_modules/yaml/dist/types.js
	new file:   node_modules/yaml/dist/util.js
	new file:   node_modules/yaml/dist/warnings-1000a372.js
	new file:   node_modules/yaml/index.d.ts
	new file:   node_modules/yaml/index.js
	new file:   node_modules/yaml/map.js
	new file:   node_modules/yaml/package.json
	new file:   node_modules/yaml/pair.js
	new file:   node_modules/yaml/parse-cst.d.ts
	new file:   node_modules/yaml/parse-cst.js
	new file:   node_modules/yaml/scalar.js
	new file:   node_modules/yaml/schema.js
	new file:   node_modules/yaml/seq.js
	new file:   node_modules/yaml/types.d.ts
	new file:   node_modules/yaml/types.js
	new file:   node_modules/yaml/types.mjs
	new file:   node_modules/yaml/types/binary.js
	new file:   node_modules/yaml/types/omap.js
	new file:   node_modules/yaml/types/pairs.js
	new file:   node_modules/yaml/types/set.js
	new file:   node_modules/yaml/types/timestamp.js
	new file:   node_modules/yaml/util.d.ts
	new file:   node_modules/yaml/util.js
	new file:   node_modules/yaml/util.mjs
	new file:   node_modules/yargs-parser/CHANGELOG.md
	new file:   node_modules/yargs-parser/LICENSE.txt
	new file:   node_modules/yargs-parser/README.md
	new file:   node_modules/yargs-parser/browser.js
	new file:   node_modules/yargs-parser/build/index.cjs
	new file:   node_modules/yargs-parser/build/lib/index.js
	new file:   node_modules/yargs-parser/build/lib/string-utils.js
	new file:   node_modules/yargs-parser/build/lib/tokenize-arg-string.js
	new file:   node_modules/yargs-parser/build/lib/yargs-parser-types.js
	new file:   node_modules/yargs-parser/build/lib/yargs-parser.js
	new file:   node_modules/yargs-parser/package.json
	new file:   node_modules/yargs/LICENSE
	new file:   node_modules/yargs/README.md
	new file:   node_modules/yargs/browser.mjs
	new file:   node_modules/yargs/build/index.cjs
	new file:   node_modules/yargs/build/lib/argsert.js
	new file:   node_modules/yargs/build/lib/command.js
	new file:   node_modules/yargs/build/lib/completion-templates.js
	new file:   node_modules/yargs/build/lib/completion.js
	new file:   node_modules/yargs/build/lib/middleware.js
	new file:   node_modules/yargs/build/lib/parse-command.js
	new file:   node_modules/yargs/build/lib/typings/common-types.js
	new file:   node_modules/yargs/build/lib/typings/yargs-parser-types.js
	new file:   node_modules/yargs/build/lib/usage.js
	new file:   node_modules/yargs/build/lib/utils/apply-extends.js
	new file:   node_modules/yargs/build/lib/utils/is-promise.js
	new file:   node_modules/yargs/build/lib/utils/levenshtein.js
	new file:   node_modules/yargs/build/lib/utils/maybe-async-result.js
	new file:   node_modules/yargs/build/lib/utils/obj-filter.js
	new file:   node_modules/yargs/build/lib/utils/process-argv.js
	new file:   node_modules/yargs/build/lib/utils/set-blocking.js
	new file:   node_modules/yargs/build/lib/utils/which-module.js
	new file:   node_modules/yargs/build/lib/validation.js
	new file:   node_modules/yargs/build/lib/yargs-factory.js
	new file:   node_modules/yargs/build/lib/yerror.js
	new file:   node_modules/yargs/helpers/helpers.mjs
	new file:   node_modules/yargs/helpers/index.js
	new file:   node_modules/yargs/helpers/package.json
	new file:   node_modules/yargs/index.cjs
	new file:   node_modules/yargs/index.mjs
	new file:   node_modules/yargs/lib/platform-shims/browser.mjs
	new file:   node_modules/yargs/lib/platform-shims/esm.mjs
	new file:   node_modules/yargs/locales/be.json
	new file:   node_modules/yargs/locales/de.json
	new file:   node_modules/yargs/locales/en.json
	new file:   node_modules/yargs/locales/es.json
	new file:   node_modules/yargs/locales/fi.json
	new file:   node_modules/yargs/locales/fr.json
	new file:   node_modules/yargs/locales/hi.json
	new file:   node_modules/yargs/locales/hu.json
	new file:   node_modules/yargs/locales/id.json
	new file:   node_modules/yargs/locales/it.json
	new file:   node_modules/yargs/locales/ja.json
	new file:   node_modules/yargs/locales/ko.json
	new file:   node_modules/yargs/locales/nb.json
	new file:   node_modules/yargs/locales/nl.json
	new file:   node_modules/yargs/locales/nn.json
	new file:   node_modules/yargs/locales/pirate.json
	new file:   node_modules/yargs/locales/pl.json
	new file:   node_modules/yargs/locales/pt.json
	new file:   node_modules/yargs/locales/pt_BR.json
	new file:   node_modules/yargs/locales/ru.json
	new file:   node_modules/yargs/locales/th.json
	new file:   node_modules/yargs/locales/tr.json
	new file:   node_modules/yargs/locales/uk_UA.json
	new file:   node_modules/yargs/locales/uz.json
	new file:   node_modules/yargs/locales/zh_CN.json
	new file:   node_modules/yargs/locales/zh_TW.json
	new file:   node_modules/yargs/package.json
	new file:   node_modules/yargs/yargs
	new file:   package-lock.json
	new file:   package.json
	new file:   public/about/index.html
	new file:   public/about/index.xml
	new file:   public/access/index.html
	new file:   public/access/index.xml
	new file:   public/background.jpg
	new file:   public/background.mp4
	new file:   public/blog/index.html
	new file:   public/blog/index.xml
	new file:   public/categories/index.html
	new file:   public/categories/index.xml
	new file:   public/css/default-skin.css
	new file:   public/css/default-skin.png
	new file:   public/css/default-skin.svg
	new file:   public/css/photoswipe.css
	new file:   public/css/preloader.gif
	new file:   public/css/style.css
	new file:   public/index.html
	new file:   public/index.xml
	new file:   public/js/photoswipe-ui-default.min.js
	new file:   public/js/photoswipe.min.js
	new file:   public/manifesto/index.html
	new file:   public/manifesto/index.xml
	new file:   public/posts/apple-breaks-privacy/index.html
	new file:   public/posts/index.html
	new file:   public/posts/index.xml
	new file:   public/posts/main_street_against_big_tech/index.html
	new file:   public/posts/manifesto/index.html
	new file:   public/posts/what_is_done_with_personal_data/index.html
	new file:   public/projects/index.html
	new file:   public/projects/index.xml
	new file:   public/sam.ico
	new file:   public/sitemap.xml
	new file:   public/tags/index.html
	new file:   public/tags/index.xml
	new file:   public/tn.png
	new file:   resources/_gen/assets/css/ananke/css/main.css_bb5467e0521bbea6b1e66429f6ec028e.content
	new file:   resources/_gen/assets/css/ananke/css/main.css_bb5467e0521bbea6b1e66429f6ec028e.json
	new file:   resources/_gen/assets/sass/sass/style.sass_7642ba43b3212fd7d7ba324df3b88b0c.content
	new file:   resources/_gen/assets/sass/sass/style.sass_7642ba43b3212fd7d7ba324df3b88b0c.json
2023-04-21 08:57:54 -06:00

1046 lines
46 KiB
JavaScript

/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/
import { tokenizeArgString } from './tokenize-arg-string.js';
import { DefaultValuesForTypeKey } from './yargs-parser-types.js';
import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
let mixin;
export class YargsParser {
constructor(_mixin) {
mixin = _mixin;
}
parse(argsInput, options) {
const opts = Object.assign({
alias: undefined,
array: undefined,
boolean: undefined,
config: undefined,
configObjects: undefined,
configuration: undefined,
coerce: undefined,
count: undefined,
default: undefined,
envPrefix: undefined,
narg: undefined,
normalize: undefined,
string: undefined,
number: undefined,
__: undefined,
key: undefined
}, options);
// allow a string argument to be passed in rather
// than an argv array.
const args = tokenizeArgString(argsInput);
// tokenizeArgString adds extra quotes to args if argsInput is a string
// only strip those extra quotes in processValue if argsInput is a string
const inputIsString = typeof argsInput === 'string';
// aliases might have transitive relationships, normalize this.
const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
const configuration = Object.assign({
'boolean-negation': true,
'camel-case-expansion': true,
'combine-arrays': false,
'dot-notation': true,
'duplicate-arguments-array': true,
'flatten-duplicate-arrays': true,
'greedy-arrays': true,
'halt-at-non-option': false,
'nargs-eats-options': false,
'negation-prefix': 'no-',
'parse-numbers': true,
'parse-positional-numbers': true,
'populate--': false,
'set-placeholder-key': false,
'short-option-groups': true,
'strip-aliased': false,
'strip-dashed': false,
'unknown-options-as-args': false
}, opts.configuration);
const defaults = Object.assign(Object.create(null), opts.default);
const configObjects = opts.configObjects || [];
const envPrefix = opts.envPrefix;
const notFlagsOption = configuration['populate--'];
const notFlagsArgv = notFlagsOption ? '--' : '_';
const newAliases = Object.create(null);
const defaulted = Object.create(null);
// allow a i18n handler to be passed in, default to a fake one (util.format).
const __ = opts.__ || mixin.format;
const flags = {
aliases: Object.create(null),
arrays: Object.create(null),
bools: Object.create(null),
strings: Object.create(null),
numbers: Object.create(null),
counts: Object.create(null),
normalize: Object.create(null),
configs: Object.create(null),
nargs: Object.create(null),
coercions: Object.create(null),
keys: []
};
const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)');
[].concat(opts.array || []).filter(Boolean).forEach(function (opt) {
const key = typeof opt === 'object' ? opt.key : opt;
// assign to flags[bools|strings|numbers]
const assignment = Object.keys(opt).map(function (key) {
const arrayFlagKeys = {
boolean: 'bools',
string: 'strings',
number: 'numbers'
};
return arrayFlagKeys[key];
}).filter(Boolean).pop();
// assign key to be coerced
if (assignment) {
flags[assignment][key] = true;
}
flags.arrays[key] = true;
flags.keys.push(key);
});
[].concat(opts.boolean || []).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
flags.keys.push(key);
});
[].concat(opts.string || []).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
flags.keys.push(key);
});
[].concat(opts.number || []).filter(Boolean).forEach(function (key) {
flags.numbers[key] = true;
flags.keys.push(key);
});
[].concat(opts.count || []).filter(Boolean).forEach(function (key) {
flags.counts[key] = true;
flags.keys.push(key);
});
[].concat(opts.normalize || []).filter(Boolean).forEach(function (key) {
flags.normalize[key] = true;
flags.keys.push(key);
});
if (typeof opts.narg === 'object') {
Object.entries(opts.narg).forEach(([key, value]) => {
if (typeof value === 'number') {
flags.nargs[key] = value;
flags.keys.push(key);
}
});
}
if (typeof opts.coerce === 'object') {
Object.entries(opts.coerce).forEach(([key, value]) => {
if (typeof value === 'function') {
flags.coercions[key] = value;
flags.keys.push(key);
}
});
}
if (typeof opts.config !== 'undefined') {
if (Array.isArray(opts.config) || typeof opts.config === 'string') {
;
[].concat(opts.config).filter(Boolean).forEach(function (key) {
flags.configs[key] = true;
});
}
else if (typeof opts.config === 'object') {
Object.entries(opts.config).forEach(([key, value]) => {
if (typeof value === 'boolean' || typeof value === 'function') {
flags.configs[key] = value;
}
});
}
}
// create a lookup table that takes into account all
// combinations of aliases: {f: ['foo'], foo: ['f']}
extendAliases(opts.key, aliases, opts.default, flags.arrays);
// apply default values to all aliases.
Object.keys(defaults).forEach(function (key) {
(flags.aliases[key] || []).forEach(function (alias) {
defaults[alias] = defaults[key];
});
});
let error = null;
checkConfiguration();
let notFlags = [];
const argv = Object.assign(Object.create(null), { _: [] });
// TODO(bcoe): for the first pass at removing object prototype we didn't
// remove all prototypes from objects returned by this API, we might want
// to gradually move towards doing so.
const argvReturn = {};
for (let i = 0; i < args.length; i++) {
const arg = args[i];
const truncatedArg = arg.replace(/^-{3,}/, '---');
let broken;
let key;
let letters;
let m;
let next;
let value;
// any unknown option (except for end-of-options, "--")
if (arg !== '--' && isUnknownOptionAsArg(arg)) {
pushPositional(arg);
// ---, ---=, ----, etc,
}
else if (truncatedArg.match(/---+(=|$)/)) {
// options without key name are invalid.
pushPositional(arg);
continue;
// -- separated by =
}
else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
// arrays format = '--f=a b c'
if (m !== null && Array.isArray(m) && m.length >= 3) {
if (checkAllAliases(m[1], flags.arrays)) {
i = eatArray(i, m[1], args, m[2]);
}
else if (checkAllAliases(m[1], flags.nargs) !== false) {
// nargs format = '--f=monkey washing cat'
i = eatNargs(i, m[1], args, m[2]);
}
else {
setArg(m[1], m[2], true);
}
}
}
else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
m = arg.match(negatedBoolean);
if (m !== null && Array.isArray(m) && m.length >= 2) {
key = m[1];
setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
}
// -- separated by space.
}
else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) {
m = arg.match(/^--?(.+)/);
if (m !== null && Array.isArray(m) && m.length >= 2) {
key = m[1];
if (checkAllAliases(key, flags.arrays)) {
// array format = '--foo a b c'
i = eatArray(i, key, args);
}
else if (checkAllAliases(key, flags.nargs) !== false) {
// nargs format = '--foo a b c'
// should be truthy even if: flags.nargs[key] === 0
i = eatNargs(i, key, args);
}
else {
next = args[i + 1];
if (next !== undefined && (!next.match(/^-/) ||
next.match(negative)) &&
!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts)) {
setArg(key, next);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next);
i++;
}
else {
setArg(key, defaultValue(key));
}
}
}
// dot-notation flag separated by '='.
}
else if (arg.match(/^-.\..+=/)) {
m = arg.match(/^-([^=]+)=([\s\S]*)$/);
if (m !== null && Array.isArray(m) && m.length >= 3) {
setArg(m[1], m[2]);
}
// dot-notation flag separated by space.
}
else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
next = args[i + 1];
m = arg.match(/^-(.\..+)/);
if (m !== null && Array.isArray(m) && m.length >= 2) {
key = m[1];
if (next !== undefined && !next.match(/^-/) &&
!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts)) {
setArg(key, next);
i++;
}
else {
setArg(key, defaultValue(key));
}
}
}
else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
letters = arg.slice(1, -1).split('');
broken = false;
for (let j = 0; j < letters.length; j++) {
next = arg.slice(j + 2);
if (letters[j + 1] && letters[j + 1] === '=') {
value = arg.slice(j + 3);
key = letters[j];
if (checkAllAliases(key, flags.arrays)) {
// array format = '-f=a b c'
i = eatArray(i, key, args, value);
}
else if (checkAllAliases(key, flags.nargs) !== false) {
// nargs format = '-f=monkey washing cat'
i = eatNargs(i, key, args, value);
}
else {
setArg(key, value);
}
broken = true;
break;
}
if (next === '-') {
setArg(letters[j], next);
continue;
}
// current letter is an alphabetic character and next value is a number
if (/[A-Za-z]/.test(letters[j]) &&
/^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) &&
checkAllAliases(next, flags.bools) === false) {
setArg(letters[j], next);
broken = true;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], next);
broken = true;
break;
}
else {
setArg(letters[j], defaultValue(letters[j]));
}
}
key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (checkAllAliases(key, flags.arrays)) {
// array format = '-f a b c'
i = eatArray(i, key, args);
}
else if (checkAllAliases(key, flags.nargs) !== false) {
// nargs format = '-f a b c'
// should be truthy even if: flags.nargs[key] === 0
i = eatNargs(i, key, args);
}
else {
next = args[i + 1];
if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
next.match(negative)) &&
!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts)) {
setArg(key, next);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next);
i++;
}
else {
setArg(key, defaultValue(key));
}
}
}
}
else if (arg.match(/^-[0-9]$/) &&
arg.match(negative) &&
checkAllAliases(arg.slice(1), flags.bools)) {
// single-digit boolean alias, e.g: xargs -0
key = arg.slice(1);
setArg(key, defaultValue(key));
}
else if (arg === '--') {
notFlags = args.slice(i + 1);
break;
}
else if (configuration['halt-at-non-option']) {
notFlags = args.slice(i);
break;
}
else {
pushPositional(arg);
}
}
// order of precedence:
// 1. command line arg
// 2. value from env var
// 3. value from config file
// 4. value from config objects
// 5. configured default value
applyEnvVars(argv, true); // special case: check env vars that point to config file
applyEnvVars(argv, false);
setConfig(argv);
setConfigObjects();
applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
applyCoercions(argv);
if (configuration['set-placeholder-key'])
setPlaceholderKeys(argv);
// for any counts either not in args or without an explicit default, set to 0
Object.keys(flags.counts).forEach(function (key) {
if (!hasKey(argv, key.split('.')))
setArg(key, 0);
});
// '--' defaults to undefined.
if (notFlagsOption && notFlags.length)
argv[notFlagsArgv] = [];
notFlags.forEach(function (key) {
argv[notFlagsArgv].push(key);
});
if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
delete argv[key];
});
}
if (configuration['strip-aliased']) {
;
[].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
if (configuration['camel-case-expansion'] && alias.includes('-')) {
delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
}
delete argv[alias];
});
}
// Push argument into positional array, applying numeric coercion:
function pushPositional(arg) {
const maybeCoercedNumber = maybeCoerceNumber('_', arg);
if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') {
argv._.push(maybeCoercedNumber);
}
}
// how many arguments should we consume, based
// on the nargs option?
function eatNargs(i, key, args, argAfterEqualSign) {
let ii;
let toEat = checkAllAliases(key, flags.nargs);
// NaN has a special meaning for the array type, indicating that one or
// more values are expected.
toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat;
if (toEat === 0) {
if (!isUndefined(argAfterEqualSign)) {
error = Error(__('Argument unexpected for: %s', key));
}
setArg(key, defaultValue(key));
return i;
}
let available = isUndefined(argAfterEqualSign) ? 0 : 1;
if (configuration['nargs-eats-options']) {
// classic behavior, yargs eats positional and dash arguments.
if (args.length - (i + 1) + available < toEat) {
error = Error(__('Not enough arguments following: %s', key));
}
available = toEat;
}
else {
// nargs will not consume flag arguments, e.g., -abc, --foo,
// and terminates when one is observed.
for (ii = i + 1; ii < args.length; ii++) {
if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii]))
available++;
else
break;
}
if (available < toEat)
error = Error(__('Not enough arguments following: %s', key));
}
let consumed = Math.min(available, toEat);
if (!isUndefined(argAfterEqualSign) && consumed > 0) {
setArg(key, argAfterEqualSign);
consumed--;
}
for (ii = i + 1; ii < (consumed + i + 1); ii++) {
setArg(key, args[ii]);
}
return (i + consumed);
}
// if an option is an array, eat all non-hyphenated arguments
// following it... YUM!
// e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
function eatArray(i, key, args, argAfterEqualSign) {
let argsToSet = [];
let next = argAfterEqualSign || args[i + 1];
// If both array and nargs are configured, enforce the nargs count:
const nargsCount = checkAllAliases(key, flags.nargs);
if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {
argsToSet.push(true);
}
else if (isUndefined(next) ||
(isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) {
// for keys without value ==> argsToSet remains an empty []
// set user default value, if available
if (defaults[key] !== undefined) {
const defVal = defaults[key];
argsToSet = Array.isArray(defVal) ? defVal : [defVal];
}
}
else {
// value in --option=value is eaten as is
if (!isUndefined(argAfterEqualSign)) {
argsToSet.push(processValue(key, argAfterEqualSign, true));
}
for (let ii = i + 1; ii < args.length; ii++) {
if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
(nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount))
break;
next = args[ii];
if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
break;
i = ii;
argsToSet.push(processValue(key, next, inputIsString));
}
}
// If both array and nargs are configured, create an error if less than
// nargs positionals were found. NaN has special meaning, indicating
// that at least one value is required (more are okay).
if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) ||
(isNaN(nargsCount) && argsToSet.length === 0))) {
error = Error(__('Not enough arguments following: %s', key));
}
setArg(key, argsToSet);
return i;
}
function setArg(key, val, shouldStripQuotes = inputIsString) {
if (/-/.test(key) && configuration['camel-case-expansion']) {
const alias = key.split('.').map(function (prop) {
return camelCase(prop);
}).join('.');
addNewAlias(key, alias);
}
const value = processValue(key, val, shouldStripQuotes);
const splitKey = key.split('.');
setKey(argv, splitKey, value);
// handle populating aliases of the full key
if (flags.aliases[key]) {
flags.aliases[key].forEach(function (x) {
const keyProperties = x.split('.');
setKey(argv, keyProperties, value);
});
}
// handle populating aliases of the first element of the dot-notation key
if (splitKey.length > 1 && configuration['dot-notation']) {
;
(flags.aliases[splitKey[0]] || []).forEach(function (x) {
let keyProperties = x.split('.');
// expand alias with nested objects in key
const a = [].concat(splitKey);
a.shift(); // nuke the old key.
keyProperties = keyProperties.concat(a);
// populate alias only if is not already an alias of the full key
// (already populated above)
if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) {
setKey(argv, keyProperties, value);
}
});
}
// Set normalize getter and setter when key is in 'normalize' but isn't an array
if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
const keys = [key].concat(flags.aliases[key] || []);
keys.forEach(function (key) {
Object.defineProperty(argvReturn, key, {
enumerable: true,
get() {
return val;
},
set(value) {
val = typeof value === 'string' ? mixin.normalize(value) : value;
}
});
});
}
}
function addNewAlias(key, alias) {
if (!(flags.aliases[key] && flags.aliases[key].length)) {
flags.aliases[key] = [alias];
newAliases[alias] = true;
}
if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
addNewAlias(alias, key);
}
}
function processValue(key, val, shouldStripQuotes) {
// strings may be quoted, clean this up as we assign values.
if (shouldStripQuotes) {
val = stripQuotes(val);
}
// handle parsing boolean arguments --foo=true --bar false.
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
if (typeof val === 'string')
val = val === 'true';
}
let value = Array.isArray(val)
? val.map(function (v) { return maybeCoerceNumber(key, v); })
: maybeCoerceNumber(key, val);
// increment a count given as arg (either no value or value parsed as boolean)
if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
value = increment();
}
// Set normalized value when key is in 'normalize' and in 'arrays'
if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
if (Array.isArray(val))
value = val.map((val) => { return mixin.normalize(val); });
else
value = mixin.normalize(val);
}
return value;
}
function maybeCoerceNumber(key, value) {
if (!configuration['parse-positional-numbers'] && key === '_')
return value;
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`))));
if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) {
value = Number(value);
}
}
return value;
}
// set args from config.json file, this should be
// applied last so that defaults can be applied.
function setConfig(argv) {
const configLookup = Object.create(null);
// expand defaults/aliases, in-case any happen to reference
// the config.json file.
applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
Object.keys(flags.configs).forEach(function (configKey) {
const configPath = argv[configKey] || configLookup[configKey];
if (configPath) {
try {
let config = null;
const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
const resolveConfig = flags.configs[configKey];
if (typeof resolveConfig === 'function') {
try {
config = resolveConfig(resolvedConfigPath);
}
catch (e) {
config = e;
}
if (config instanceof Error) {
error = config;
return;
}
}
else {
config = mixin.require(resolvedConfigPath);
}
setConfigObject(config);
}
catch (ex) {
// Deno will receive a PermissionDenied error if an attempt is
// made to load config without the --allow-read flag:
if (ex.name === 'PermissionDenied')
error = ex;
else if (argv[configKey])
error = Error(__('Invalid JSON config file: %s', configPath));
}
}
});
}
// set args from config object.
// it recursively checks nested objects.
function setConfigObject(config, prev) {
Object.keys(config).forEach(function (key) {
const value = config[key];
const fullKey = prev ? prev + '.' + key : key;
// if the value is an inner object and we have dot-notation
// enabled, treat inner objects in config the same as
// heavily nested dot notations (foo.bar.apple).
if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
// if the value is an object but not an array, check nested object
setConfigObject(value, fullKey);
}
else {
// setting arguments via CLI takes precedence over
// values within the config file.
if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
setArg(fullKey, value);
}
}
});
}
// set all config objects passed in opts
function setConfigObjects() {
if (typeof configObjects !== 'undefined') {
configObjects.forEach(function (configObject) {
setConfigObject(configObject);
});
}
}
function applyEnvVars(argv, configOnly) {
if (typeof envPrefix === 'undefined')
return;
const prefix = typeof envPrefix === 'string' ? envPrefix : '';
const env = mixin.env();
Object.keys(env).forEach(function (envVar) {
if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
// get array of nested keys and convert them to camel case
const keys = envVar.split('__').map(function (key, i) {
if (i === 0) {
key = key.substring(prefix.length);
}
return camelCase(key);
});
if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) {
setArg(keys.join('.'), env[envVar]);
}
}
});
}
function applyCoercions(argv) {
let coerce;
const applied = new Set();
Object.keys(argv).forEach(function (key) {
if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases
coerce = checkAllAliases(key, flags.coercions);
if (typeof coerce === 'function') {
try {
const value = maybeCoerceNumber(key, coerce(argv[key]));
([].concat(flags.aliases[key] || [], key)).forEach(ali => {
applied.add(ali);
argv[ali] = value;
});
}
catch (err) {
error = err;
}
}
}
});
}
function setPlaceholderKeys(argv) {
flags.keys.forEach((key) => {
// don't set placeholder keys for dot notation options 'foo.bar'.
if (~key.indexOf('.'))
return;
if (typeof argv[key] === 'undefined')
argv[key] = undefined;
});
return argv;
}
function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) {
Object.keys(defaults).forEach(function (key) {
if (!hasKey(obj, key.split('.'))) {
setKey(obj, key.split('.'), defaults[key]);
if (canLog)
defaulted[key] = true;
(aliases[key] || []).forEach(function (x) {
if (hasKey(obj, x.split('.')))
return;
setKey(obj, x.split('.'), defaults[key]);
});
}
});
}
function hasKey(obj, keys) {
let o = obj;
if (!configuration['dot-notation'])
keys = [keys.join('.')];
keys.slice(0, -1).forEach(function (key) {
o = (o[key] || {});
});
const key = keys[keys.length - 1];
if (typeof o !== 'object')
return false;
else
return key in o;
}
function setKey(obj, keys, value) {
let o = obj;
if (!configuration['dot-notation'])
keys = [keys.join('.')];
keys.slice(0, -1).forEach(function (key) {
// TODO(bcoe): in the next major version of yargs, switch to
// Object.create(null) for dot notation:
key = sanitizeKey(key);
if (typeof o === 'object' && o[key] === undefined) {
o[key] = {};
}
if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
// ensure that o[key] is an array, and that the last item is an empty object.
if (Array.isArray(o[key])) {
o[key].push({});
}
else {
o[key] = [o[key], {}];
}
// we want to update the empty object at the end of the o[key] array, so set o to that object
o = o[key][o[key].length - 1];
}
else {
o = o[key];
}
});
// TODO(bcoe): in the next major version of yargs, switch to
// Object.create(null) for dot notation:
const key = sanitizeKey(keys[keys.length - 1]);
const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays);
const isValueArray = Array.isArray(value);
let duplicate = configuration['duplicate-arguments-array'];
// nargs has higher priority than duplicate
if (!duplicate && checkAllAliases(key, flags.nargs)) {
duplicate = true;
if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
o[key] = undefined;
}
}
if (value === increment()) {
o[key] = increment(o[key]);
}
else if (Array.isArray(o[key])) {
if (duplicate && isTypeArray && isValueArray) {
o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
}
else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
o[key] = value;
}
else {
o[key] = o[key].concat([value]);
}
}
else if (o[key] === undefined && isTypeArray) {
o[key] = isValueArray ? value : [value];
}
else if (duplicate && !(o[key] === undefined ||
checkAllAliases(key, flags.counts) ||
checkAllAliases(key, flags.bools))) {
o[key] = [o[key], value];
}
else {
o[key] = value;
}
}
// extend the aliases list with inferred aliases.
function extendAliases(...args) {
args.forEach(function (obj) {
Object.keys(obj || {}).forEach(function (key) {
// short-circuit if we've already added a key
// to the aliases array, for example it might
// exist in both 'opts.default' and 'opts.key'.
if (flags.aliases[key])
return;
flags.aliases[key] = [].concat(aliases[key] || []);
// For "--option-name", also set argv.optionName
flags.aliases[key].concat(key).forEach(function (x) {
if (/-/.test(x) && configuration['camel-case-expansion']) {
const c = camelCase(x);
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
flags.aliases[key].push(c);
newAliases[c] = true;
}
}
});
// For "--optionName", also set argv['option-name']
flags.aliases[key].concat(key).forEach(function (x) {
if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {
const c = decamelize(x, '-');
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
flags.aliases[key].push(c);
newAliases[c] = true;
}
}
});
flags.aliases[key].forEach(function (x) {
flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {
return x !== y;
}));
});
});
});
}
function checkAllAliases(key, flag) {
const toCheck = [].concat(flags.aliases[key] || [], key);
const keys = Object.keys(flag);
const setAlias = toCheck.find(key => keys.includes(key));
return setAlias ? flag[setAlias] : false;
}
function hasAnyFlag(key) {
const flagsKeys = Object.keys(flags);
const toCheck = [].concat(flagsKeys.map(k => flags[k]));
return toCheck.some(function (flag) {
return Array.isArray(flag) ? flag.includes(key) : flag[key];
});
}
function hasFlagsMatching(arg, ...patterns) {
const toCheck = [].concat(...patterns);
return toCheck.some(function (pattern) {
const match = arg.match(pattern);
return match && hasAnyFlag(match[1]);
});
}
// based on a simplified version of the short flag group parsing logic
function hasAllShortFlags(arg) {
// if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group
if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
return false;
}
let hasAllFlags = true;
let next;
const letters = arg.slice(1).split('');
for (let j = 0; j < letters.length; j++) {
next = arg.slice(j + 2);
if (!hasAnyFlag(letters[j])) {
hasAllFlags = false;
break;
}
if ((letters[j + 1] && letters[j + 1] === '=') ||
next === '-' ||
(/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) ||
(letters[j + 1] && letters[j + 1].match(/\W/))) {
break;
}
}
return hasAllFlags;
}
function isUnknownOptionAsArg(arg) {
return configuration['unknown-options-as-args'] && isUnknownOption(arg);
}
function isUnknownOption(arg) {
arg = arg.replace(/^-{3,}/, '--');
// ignore negative numbers
if (arg.match(negative)) {
return false;
}
// if this is a short option group and all of them are configured, it isn't unknown
if (hasAllShortFlags(arg)) {
return false;
}
// e.g. '--count=2'
const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
// e.g. '-a' or '--arg'
const normalFlag = /^-+([^=]+?)$/;
// e.g. '-a-'
const flagEndingInHyphen = /^-+([^=]+?)-$/;
// e.g. '-abc123'
const flagEndingInDigits = /^-+([^=]+?\d+)$/;
// e.g. '-a/usr/local'
const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
// check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method
return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
}
// make a best effort to pick a default value
// for an option based on name and type.
function defaultValue(key) {
if (!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts) &&
`${key}` in defaults) {
return defaults[key];
}
else {
return defaultForType(guessType(key));
}
}
// return a default value, given the type of a flag.,
function defaultForType(type) {
const def = {
[DefaultValuesForTypeKey.BOOLEAN]: true,
[DefaultValuesForTypeKey.STRING]: '',
[DefaultValuesForTypeKey.NUMBER]: undefined,
[DefaultValuesForTypeKey.ARRAY]: []
};
return def[type];
}
// given a flag, enforce a default type.
function guessType(key) {
let type = DefaultValuesForTypeKey.BOOLEAN;
if (checkAllAliases(key, flags.strings))
type = DefaultValuesForTypeKey.STRING;
else if (checkAllAliases(key, flags.numbers))
type = DefaultValuesForTypeKey.NUMBER;
else if (checkAllAliases(key, flags.bools))
type = DefaultValuesForTypeKey.BOOLEAN;
else if (checkAllAliases(key, flags.arrays))
type = DefaultValuesForTypeKey.ARRAY;
return type;
}
function isUndefined(num) {
return num === undefined;
}
// check user configuration settings for inconsistencies
function checkConfiguration() {
// count keys should not be set as array/narg
Object.keys(flags.counts).find(key => {
if (checkAllAliases(key, flags.arrays)) {
error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key));
return true;
}
else if (checkAllAliases(key, flags.nargs)) {
error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key));
return true;
}
return false;
});
}
return {
aliases: Object.assign({}, flags.aliases),
argv: Object.assign(argvReturn, argv),
configuration: configuration,
defaulted: Object.assign({}, defaulted),
error: error,
newAliases: Object.assign({}, newAliases)
};
}
}
// if any aliases reference each other, we should
// merge them together.
function combineAliases(aliases) {
const aliasArrays = [];
const combined = Object.create(null);
let change = true;
// turn alias lookup hash {key: ['alias1', 'alias2']} into
// a simple array ['key', 'alias1', 'alias2']
Object.keys(aliases).forEach(function (key) {
aliasArrays.push([].concat(aliases[key], key));
});
// combine arrays until zero changes are
// made in an iteration.
while (change) {
change = false;
for (let i = 0; i < aliasArrays.length; i++) {
for (let ii = i + 1; ii < aliasArrays.length; ii++) {
const intersect = aliasArrays[i].filter(function (v) {
return aliasArrays[ii].indexOf(v) !== -1;
});
if (intersect.length) {
aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
aliasArrays.splice(ii, 1);
change = true;
break;
}
}
}
}
// map arrays back to the hash-lookup (de-dupe while
// we're at it).
aliasArrays.forEach(function (aliasArray) {
aliasArray = aliasArray.filter(function (v, i, self) {
return self.indexOf(v) === i;
});
const lastAlias = aliasArray.pop();
if (lastAlias !== undefined && typeof lastAlias === 'string') {
combined[lastAlias] = aliasArray;
}
});
return combined;
}
// this function should only be called when a count is given as an arg
// it is NOT called to set a default value
// thus we can start the count at 1 instead of 0
function increment(orig) {
return orig !== undefined ? orig + 1 : 1;
}
// TODO(bcoe): in the next major version of yargs, switch to
// Object.create(null) for dot notation:
function sanitizeKey(key) {
if (key === '__proto__')
return '___proto___';
return key;
}
function stripQuotes(val) {
return (typeof val === 'string' &&
(val[0] === "'" || val[0] === '"') &&
val[val.length - 1] === val[0])
? val.substring(1, val.length - 1)
: val;
}