Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

string-argv

Package Overview
Dependencies
0
Maintainers
2
Versions
9
Issues
File Explorer

Advanced tools

string-argv

string-argv parses a string into an argument array to mimic process.argv. This is useful when testing Command Line Utilities that you want to pass arguments to.

    0.3.1latest

Version published
Maintainers
2
Weekly downloads
7,005,021
decreased by-8.51%

Weekly downloads

Readme

Source

What is it?

string-argv parses a string into an argument array to mimic process.argv. This is useful when testing Command Line Utilities that you want to pass arguments to and is the opposite of what the other argv utilities do.

Installation

npm install string-argv --save

Usage

// Typescript import stringArgv from 'string-argv'; const args = stringArgv( '-testing test -valid=true --quotes "test quotes" "nested \'quotes\'" --key="some value" --title="Peter\'s Friends"', 'node', 'testing.js' ); console.log(args); // Javascript var { parseArgsStringToArgv } = require('string-argv'); var args = parseArgsStringToArgv( '-testing test -valid=true --quotes "test quotes" "nested \'quotes\'" --key="some value" --title="Peter\'s Friends"', 'node', 'testing.js' ); console.log(args); /** output [ 'node', 'testing.js', '-testing', 'test', '-valid=true', '--quotes', 'test quotes', 'nested \'quotes\'', '--key="some value"', '--title="Peter\'s Friends"' ] **/

params

required: arguments String: arguments that you would normally pass to the command line.

optional: environment String: Adds to the environment position in the argv array. If ommitted then there is no need to call argv.split(2) to remove the environment/file values. However if your cli.parse method expects a valid argv value then you should include this value.

optional: file String: file that called the arguments. If omitted then there is no need to call argv.split(2) to remove the environment/file values. However if your cli.parse method expects a valid argv value then you should include this value.

Keywords

FAQs

What is string-argv?

string-argv parses a string into an argument array to mimic process.argv. This is useful when testing Command Line Utilities that you want to pass arguments to.

Is string-argv popular?

The npm package string-argv receives a total of 6,735,688 weekly downloads. As such, string-argv popularity was classified as popular.

Is string-argv well maintained?

We found that string-argv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 2 open source maintainers collaborating on the project.

Last updated on 29 Aug 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc