https://github.com/ksxnodeapps/argv-to-list
Print each command-line argument as a line
https://github.com/ksxnodeapps/argv-to-list
argv chunk list stdout
Last synced: 3 months ago
JSON representation
Print each command-line argument as a line
- Host: GitHub
- URL: https://github.com/ksxnodeapps/argv-to-list
- Owner: ksxnodeapps
- License: mit
- Created: 2017-06-06T21:44:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T09:46:52.000Z (over 7 years ago)
- Last Synced: 2025-02-06T07:47:35.591Z (3 months ago)
- Topics: argv, chunk, list, stdout
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/argv-to-list
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# argv-to-list
Print each command-line argument as a line
## Requirements
* Node.js ≥ 6.0.0, and npm
## Installation
```bash
npm install --global argv-to-list
```## Usage
### Basic
```bash
argv-to-list first second 'This argument contains spaces'
```**Output:** The following text would be printed to terminal screen
```text
first
second
This argument contains spaces
```### Advanced
#### Chunks of data
Each argument is pushed to stdout seperately, that means there are each chunk of stdout for every one of them.
**Example:**
```javascript
const arguments = ['abc\ndef\nghi\njkl', 'foo\nbar']
const {stdout} = require('child_process').spawn('argv-to-list', arguments)
const print = chunk => console.log({chunk: String(chunk)})
stdout.on('data', print)
```This is the output:
```text
{ chunk: 'abc\ndef\nghi\njkl\n' }
{ chunk: 'foo\nbar\n' }
```#### As a module
```typescript
argvToList(input = process.argv, begin = 2, end?: number): void
```