-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add @npmcli/template-oss and modernize
BREAKING CHANGE: - callback has been removed from the async interface, it is now `Promise` only - `which` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0 - cli now ignores any arguments after `--`
- Loading branch information
1 parent
43abbef
commit 5b13666
Showing
19 changed files
with
378 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# Changes | ||
|
||
# Changelog | ||
|
||
## 2.0.2 | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
|
||
const which = require('../lib') | ||
const argv = process.argv.slice(2) | ||
|
||
const usage = (err) => { | ||
if (err) { | ||
console.error(`which: ${err}`) | ||
} | ||
console.error('usage: which [-as] program ...') | ||
process.exit(1) | ||
} | ||
|
||
if (!argv.length) { | ||
return usage() | ||
} | ||
|
||
let dashdash = false | ||
const [cmds, flags] = argv.reduce((acc, arg) => { | ||
if (dashdash || arg === '--') { | ||
dashdash = true | ||
return acc | ||
} | ||
|
||
if (!/^-/.test(arg)) { | ||
acc[0].push(arg) | ||
return acc | ||
} | ||
|
||
for (const flag of arg.slice(1).split('')) { | ||
if (flag === 's') { | ||
acc[1].silent = true | ||
} else if (flag === 'a') { | ||
acc[1].all = true | ||
} else { | ||
usage(`illegal option -- ${flag}`) | ||
} | ||
} | ||
|
||
return acc | ||
}, [[], {}]) | ||
|
||
for (const cmd of cmds) { | ||
try { | ||
const res = which.sync(cmd, { all: flags.all }) | ||
if (!flags.silent) { | ||
console.log([].concat(res).join('\n')) | ||
} | ||
} catch (err) { | ||
process.exitCode = 1 | ||
} | ||
} |
Oops, something went wrong.