Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oresoftware/parse-command

Parse an arbitrary command string, reliably, using a child process.
https://github.com/oresoftware/parse-command

bash child-process node nodejs npm

Last synced: 4 months ago
JSON representation

Parse an arbitrary command string, reliably, using a child process.

Awesome Lists containing this project

README

        

# Parse a command using bash/OS

### Installation

```bash
$ npm i parse-command
```

### Usage

```javascript
const {parseCommand} = require('parse-command');

parseCommand('--foo=5 --bar="/a file/path" --zoom -z', function(err, val){
// val is parsed array
// val => [ '--foo=5', '--bar=/a file/path', '--zoom', '-z' ]
});

// using promises
const {parseCommandp} = require('parse-command');

parseCommandp('--foo=5 --bar="/a file/path" --zoom -z').then(function(val){
// val is parsed array
// val => [ '--foo=5', '--bar=/a file/path', '--zoom', '-z' ]
});

```