Browse Source

Added parameters in README

master
Dan Cojocaru 4 years ago
parent
commit
10aadc1179
Signed by: kbruen
GPG Key ID: 818A889458EDC937
  1. 12
      README.md
  2. 6
      bin/kennson.dart

12
README.md

@ -13,3 +13,15 @@ dart compile exe bin/kennson.dart
``` ```
The compiled executable will be inside the `bin` folder, named `kennson.exe` (regardless of platform). The compiled executable will be inside the `bin` folder, named `kennson.exe` (regardless of platform).
## Parameters
```text
-f, --file=<filename> Read JSON from file instead of stdin
--input=<json input> Read JSON as parameter instead of stdin
--jsonpath=<JSONPath query> Display only the matches of the JSON document
-p, --jsonpointer=<JSON Pointer> Display only the matches of the JSON pointer
-i, --indent Set space indentation level (prefix with t for tab indentation)
(defaults to "2")
-d, --max-depth Specify maximum nesting before stopping printing
```

6
bin/kennson.dart

@ -10,11 +10,11 @@ import 'ppjson.dart';
void main(List<String> arguments) { void main(List<String> arguments) {
final parser = ArgParser() final parser = ArgParser()
..addOption('file', abbr: 'f', help: 'Read JSON from file instead of stdin', valueHelp: 'filename') ..addOption('file', abbr: 'f', help: 'Read JSON from file instead of stdin', valueHelp: 'filename')
..addOption('input', help: 'Read input as parameter instead of stdin', valueHelp: 'json input') ..addOption('input', help: 'Read JSON as parameter instead of stdin', valueHelp: 'json input')
..addOption('jsonpath', aliases: ['path'], help: 'Display only the matches of the JSON document', valueHelp: 'JSONPath query') ..addOption('jsonpath', aliases: ['path'], help: 'Display only the matches of the JSON document', valueHelp: 'JSONPath query')
..addOption('jsonpointer', aliases: ['pointer'], abbr: 'p', help: 'Display only the matches of the JSON pointer') ..addOption('jsonpointer', aliases: ['pointer'], abbr: 'p', help: 'Display only the matches of the JSON pointer', valueHelp: 'JSON Pointer')
..addOption('indent', abbr: 'i', help: 'Set space indentation level (prefix with t for tab indentation)', defaultsTo: '2') ..addOption('indent', abbr: 'i', help: 'Set space indentation level (prefix with t for tab indentation)', defaultsTo: '2')
..addOption('max-depth', abbr: 'm', help: 'Specify maximum nesting before stopping printing'); ..addOption('max-depth', abbr: 'd', help: 'Specify maximum nesting before stopping printing');
// ..addFlag('force-color', help: "Output using colors even when the environment doesn't allow them", hide: true); // ..addFlag('force-color', help: "Output using colors even when the environment doesn't allow them", hide: true);
final ArgResults parsedArgs; final ArgResults parsedArgs;
try { try {

Loading…
Cancel
Save