simpleargumentsparser
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
const parseCLI = require("./index.js"); | ||
const parseCLI = require("simpleargumentsparser"); | ||
@@ -3,0 +3,0 @@ (async() => { |
{ | ||
"name": "simpleargumentsparser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Parse CLI arguments from node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,6 +7,9 @@ # simpleArgumentsParser | ||
### Why Use | ||
You can make your own even simplier parser adapted exactly to your code requeriments. But using this library, you can save a lot of time. Writing custom parsers like i was doing for each command, takes a good amount of time. More even on simpier ones. Just better throw a npm install, a require await the parser and you ready to go. | ||
You can make your own even simplier parser adapted exactly to your code requeriments. But using this library, you can save a lot of time. | ||
Writing custom parsers like i was doing for each command, takes a good amount of time. More even on simpler ones. Just better throw a npm install, a require await the parser and you ready to go. | ||
### Why not other? | ||
I created this library because i don't like any of other command parsers i tryied. Some are to basic, others are to bug for a simple parsing, others just don't work well and other are to complicated. | ||
I probably will be using this library from now. So i will be finding and fixing errors, improving the code, etc. It's going to get much better. | ||
@@ -17,3 +20,3 @@ | ||
```bash | ||
npm i THIS_PACKAGE_IS_NOT_YET_IN_NPM | ||
npm i simpleargumentsparser | ||
``` | ||
@@ -36,48 +39,58 @@ | ||
- s | ||
s holds single hyphen arguments like -v | ||
s allow multiple arguments after a single hyphen like -lvk | ||
If text dosn't follow, true is assigned | ||
If text follows, takes it as value of argument | ||
Ex: $ helloworld -n Manolo -vd | ||
s: { n: "Manolo", v: true, d: true } | ||
- #### s | ||
- s holds single hyphen arguments like -v | ||
- s allow multiple arguments after a single hyphen like -lvk | ||
- If text dosn't follow, true is assigned | ||
- If text follows, takes it as value of argument | ||
```bash | ||
$ helloworld -n Manolo -vd | ||
``` | ||
> s: { n: "Manolo", v: true, d: true } | ||
- c | ||
c holds double guion arguments like --add | ||
c allows guions between words like --add-new-number | ||
If text doesn't follow, true is assigned | ||
If text follows, takes it as value of argument | ||
Ex: $ helloworld --name String --last-name Manolo --verbose | ||
c: { name: "String", 'last-name': "Manolo", verbose: true } | ||
- #### c | ||
- c holds double guion arguments like --add | ||
- c allows guions between words like --add-new-number | ||
- If text doesn't follow, true is assigned | ||
- If text follows, takes it as value of argument | ||
```bash | ||
$ helloworld --name String --last-name Manolo --verbose | ||
``` | ||
> c: { name: "String", 'last-name': "Manolo", verbose: true } | ||
- o | ||
o holds other arguments (anything else found, except - and -- ) | ||
o Arguments are followed by a number indicating their position | ||
Ex: $ helloworld hello how are you | ||
o: [ [ "hello", 1 ], [ "how", 2 ], [ "are", 3 ], [ "you", 4 ] ] | ||
- #### o | ||
- o holds other arguments (anything else found, except - and -- ) | ||
- o Arguments are followed by a number indicating their position | ||
```bash | ||
$ helloworld hello how are you | ||
``` | ||
> o: [ [ "hello", 1 ], [ "how", 2 ], [ "are", 3 ], [ "you", 4 ] ] | ||
- p | ||
p holds pipped input data | ||
You can use pipped and arguments together | ||
Ex: $ echo "Hey!" | helloworld -n Manolo | ||
p: "Hey!", | ||
s: { n: 'Manolo' } | ||
- #### p | ||
- p holds pipped input data | ||
- You can use pipped and arguments together | ||
```bash | ||
$ echo "Hey!" | helloworld -n Manolo | ||
``` | ||
> p: "Hey!", | ||
> s: { n: 'Manolo' } | ||
- e | ||
e holds errors and the some time used double hyphen end command | ||
_Errors will be added in the future_ | ||
Ex: $ helloworld -v -- helloworld2 -v -- helloworld3 -v | ||
e: [ 2, 5 ] | ||
- #### e | ||
- e holds errors and the some time used double hyphen end command | ||
- _Errors will be added in the future_ | ||
```bash | ||
$ helloworld -v -- helloworld2 -v -- helloworld3 -v | ||
``` | ||
> e: [ 2, 5 ] | ||
- noArgs | ||
noArgs is just a boolean set to true if no arguments provided | ||
If pipped is provided, noArgs will remain to false | ||
- #### noArgs | ||
- noArgs is just a boolean set to true if no arguments provided | ||
- If pipped is provided, noArgs will remain to false | ||
- argc | ||
argc counts the number of arguments | ||
__argc doesn't count pipped as an argument__ | ||
- #### argc | ||
- argc counts the number of arguments | ||
- __argc doesn't count pipped as an argument__ | ||
```javascript | ||
const parseCLI = require("./index.js"); // TODO: Add npm name | ||
const parseCLI = require("simpleargumentsparser"); | ||
@@ -84,0 +97,0 @@ (async() => { |
@@ -1,2 +0,2 @@ | ||
const parseCLI = require("./index.js"); | ||
const parseCLI = require("simpleargumentsparser"); | ||
@@ -3,0 +3,0 @@ (async() => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7991
115