https://github.com/aneldev/dyna-node-arguments
Read simpler nodeJS complex command line arguments
https://github.com/aneldev/dyna-node-arguments
Last synced: about 1 month ago
JSON representation
Read simpler nodeJS complex command line arguments
- Host: GitHub
- URL: https://github.com/aneldev/dyna-node-arguments
- Owner: aneldev
- License: mit
- Created: 2020-06-17T07:06:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T02:26:21.000Z (over 3 years ago)
- Last Synced: 2025-12-25T12:46:18.178Z (6 months ago)
- Language: JavaScript
- Size: 3.46 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dyna-node-arguments
Simplify the way you read nodeJS command line arguments.
The double dash used to declare a variable and the rest are the values of the variable.
The `dynaNodeArguments` is an object variable with values.
# Import
```
import {dynaNodeArguments} from "dyna-node-arguments"
```
# Examples
### command line: node myApp.js
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"root": "",
},
}
```
### command line: node myApp.js --ENV_MODE production
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"ENV_MODE": "production",
"root": "",
},
}
```
### command line: node myApp.js --ENV_MODE production secure
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"ENV_MODE": "production secure",
"root": "",
},
}
```
### command line: node myApp.js --ENV_MODE production secure --TARGET mobile android
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"ENV_MODE": "production secure",
"TARGET": "mobile android",
"root": "",
},
}
```
### command line: node myApp.js --ENV_MODE production -secure -- -verbose
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"ENV_MODE": "production -secure",
"root": "-verbose",
},
}
```
### command line: node myApp.js --ENV_MODE production secure -- basics --TARGET mobile android
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"ENV_MODE": "production secure",
"TARGET": "mobile android",
"root": "basics",
},
}
```
### command line: node myApp.js build --title Hello World --mode silent --title v2 -- verbose
```
{
"node": "/Users/john/.nvm/versions/node/v12.16.1/bin/node",
"app": "myApp.js",
"args": {
"mode": "silent",
"root": "build verbose",
"title": "Hello World v2",
},
}
```