/pleasure-swiss-army

Set of tools for building pleasure projects

Primary LanguageJavaScript

pleasure-swiss-army/Cli

Set of utilities for cli applications

pleasure-swiss-army/Cli~obj2ArgsArray(obj) ⇒ Array

Converts given object into an array of arguments

Kind: inner method of pleasure-swiss-army/Cli
Returns: Array - Arguments array

Param Type
obj Object

Example

const args = {
  noLockfile: true,
  ignoreEngines: false,
  json: true
}

obj2ArgsArray(args)
// outputs: ['--no-lockfile', '--json']

pleasure-swiss-army/Cli~exec(command, [args], cwd, env, env, [progress]) ⇒ Promise.<ExecResult>

Uses an spawn process to execute given command

Kind: inner method of pleasure-swiss-army/Cli
Returns: Promise.<ExecResult> - The child process output
Throws:

  • Error stderr output if any
Param Type Default Description
command String The command to execute
[args] Object Object to be converted as terminal kind of parameters using obj2ArgsArray
cwd String process.cwd() Object to pass as the env of the child process
env Object process.env Object to pass as the env of the child process
env Object process.env Object to pass as the env of the child process
[progress] function Callback function that receives the progress of the operation

pleasure-swiss-army/Cli~ExecResult : Object

Kind: inner typedef of pleasure-swiss-army/Cli
Properties

Name Type Description
result String Resulted output from stdout
errors String Any errors received via stderr

© 2019 Martin Rafael tin@devtin.io