Skip to content

Commit

Permalink
Merge pull request #9 from sirbrillig/fix-verbose
Browse files Browse the repository at this point in the history
Add verbose to options properly
  • Loading branch information
sirbrillig authored Aug 21, 2020
2 parents 8254864 + 95c0ce3 commit 13f3e7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Print this help text.

Print the version information.

--verbose

Print the raw grep command being run.

## Example

```
Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,26 @@ Options:
-v, --version
Print the version information.
--verbose
Print additional information when running, like the raw grep command.
`;
console.log(helpText);
}

async function grepdef(args) {
const options = minimist(args, {
string: ['type', 'searcher', 'reporter'],
boolean: ['n', 'line-number', 'help', 'h', 'no-color', 'v', 'version'],
boolean: ['n', 'line-number', 'help', 'h', 'no-color', 'v', 'version', 'verbose'],
});
const langType = options.type;
const searchTool = options.searcher || 'ripgrep';
const reporterName = options.reporter || 'human';
const showLineNumbers = options.n || options['line-number'];
const disableColor = options['no-color'];
const searchSymbol = options._[0];
const verbose = options.verbose;
const path = options._.slice(1).join(' ') || '.';
if (options.h || options.help) {
printHelp();
Expand All @@ -100,7 +105,7 @@ async function grepdef(args) {
searchSymbol,
{
type: langType ? normalizeType(langType) : null,
verbose: !!options.verbose,
verbose,
searchTool,
path,
showLineNumbers,
Expand Down

0 comments on commit 13f3e7a

Please sign in to comment.