- progress on chalk deno
This commit is contained in:
parent
f8a3642a81
commit
dcc200ab1b
8 changed files with 634 additions and 2 deletions
6
source/has-flag/index.js
Normal file
6
source/has-flag/index.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export default function hasFlag(flag, argv = Deno.args) {
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const position = argv.indexOf(prefix + flag);
|
||||
const terminatorPosition = argv.indexOf('--');
|
||||
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue