{"_id":"o-command-line","_rev":"5-2a249ec6366e9775fa1029c1ac6cdc3a","name":"o-command-line","dist-tags":{"latest":"1.0.3"},"versions":{"0.2.0":{"name":"o-command-line","version":"0.2.0","description":"Utility to execute bash commands","main":"index.js","scripts":{"test":"npx mocha --config ./utilities-config/.mocharc.json"},"author":{"name":"Martin Rubi"},"license":"ISC","homepage":"https://bitbucket.org/haijin-development/parsed-js","devDependencies":{"chai":"^4.2.0","eslint":"^7.13.0","eslint-config-standard":"^16.0.1","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.2","o-testing-toolbox":"^2.0.0","mocha":"^7","nyc":"^15.1.0"},"dependencies":{"o-check-list":"git+https://bitbucket.org/haijin-development/check-list.git#development","o-toolbox":"^2.1.0"},"gitHead":"fda0d1d743c796d2c68908ee927d8152f5c4592b","_id":"o-command-line@0.2.0","_nodeVersion":"14.12.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Q2HL98yZ0cA1pYDmai8Rbfpo6LT0ZeUy7KJy2MOmgULUfBMJn+SeVEElSHJbcqV1Ab238NVzdC2JhJCp9FTBww==","shasum":"aea710ce86b08f7feb25e218715022d7559193d0","tarball":"https://registry.npmjs.org/o-command-line/-/o-command-line-0.2.0.tgz","fileCount":7,"unpackedSize":8377,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqDxNCRA9TVsSAnZWagAAPqEP/jt1fIgt5qKvDRxQd+Uy\nyabo5CIpzKtBwxPK9xi5urylmXRE/Gjw6FP0cbWtMsWSoMt/yEMVb4mEuVuF\nGuDsCzAsoUfKa0ngq/Y110TPZsrFVg8TU6b+Xr2ZyybdRXS8obrKPHEfuQ33\nLLBp2S2xilkagLTL28zV3+2gmH7W85xHf3D1pJ+uAWdXytESrj3fZjgrUr9N\nnhawo0FpTlyAGVWm27I0ZD3dDFSWMvFYHykrr/4EoozMqt1xHHExD4KbPCYG\nLAKA3srwIJ09rkH6DNofYqLUkm0Le/QC/QdTI0C9tuTGxmHUT5/sRxrKV1kg\n0w6aH2y259deJprhrFfdYkVwngoBpEp4hJn659+d0wCVF00k57+jNT+jNU/f\nsQZm09+h3F2faNZesmRkzKGWPOzlWJqX5WwAppROECeBNSKKHCwol6yubd1E\nTLYk8hYq4IvE3tB44UnUo0a0sMsJU7xy81YE0BgYu0oVHMJmuU3tD8iTqE1B\n4BIeZ9JqCT2P3GcEX0vKvlvKiGJ83nfOrr7F+NyX6e2oUFanXrzT8A33o0+g\nOFzy5/SzHMZUxhuEjV8nAcDEDJ7rbCf++2LBnfAqT53foM0qA9wo5j3iKJC/\nS0McLNPvbChKpMHblkGA8XUMQbr1pm6QJ5vQuNd5NldZmjdYXfjHeoK1mdoO\nrAPj\r\n=K5Hi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDy1i0eKip9M01Ddk2N0Qzq19bKOW2ETVjNll1c6bSffAiArZArXEvDp4vioymQD8jDvsG5D+xl8cGiJlroALj4jCw=="}]},"_npmUser":{"name":"haijindev","email":"haijin.development@gmail.com"},"directories":{},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-command-line_0.2.0_1604861004784_0.7021808947522936"},"_hasShrinkwrap":false},"1.0.0":{"name":"o-command-line","version":"1.0.0","description":"Utility to execute bash commands","main":"index.js","scripts":{"test":"npx mocha --config ./utilities-config/.mocharc.json"},"author":{"name":"Martin Rubi"},"license":"ISC","homepage":"https://bitbucket.org/haijin-development/parsed-js","devDependencies":{"chai":"^4.2.0","eslint":"^7.13.0","eslint-config-standard":"^16.0.1","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.1.0","o-testing-toolbox":"^2.0.1","mocha":"^7","nyc":"^15.1.0"},"dependencies":{"o-check-list":"^1.0.0","o-toolbox":"^3.0.0"},"gitHead":"e1505a268467e42661100f35edfa26e44aedbefc","_id":"o-command-line@1.0.0","_nodeVersion":"14.12.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-5w1gfPetbrq41ZNDARm13eHZZ+c40o+HIml/aWjnbJzTCDjBDGBvxLbLfYlZA471i0Nta9PRZ9fiWp7mqZKnEg==","shasum":"3a42f51bab2e54c2c4a123cc5639e19d4128c1e8","tarball":"https://registry.npmjs.org/o-command-line/-/o-command-line-1.0.0.tgz","fileCount":7,"unpackedSize":10768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsAreCRA9TVsSAnZWagAARv0P/RM4Kt+H7VWbHZQm+f3D\n/VQuEvDozVnDfKbgXl8VeKi8YRVZ1Hnq2I+njH2VEkb7nu70LuUQMRZ5ioM+\ndgNQU1H8c0Y4+Nld7pnVZH5E/aoc19BV0Y4HycF5gIhr4kNQp5UYYXeh1yE3\n0GHwiWy31WhPAYWjATbWSMQ881MHFBzSEZW4/s1hzn+mpl5im79Tj823l+z7\nVrZKACA1Bk3D/X9BZECA2YH0P39T4sjkYkSFJKtuIIvkqAuj3fkLEKJ+I+Sx\njUbo1IxHALqUeCZQ+3b4GZ0vWkJmBhIopfEKqBRnbMjU0uV/QSRcSc+UVAZX\nklrZz7LKuuJUAh44geq1x/uggrKedxLq3fynuC8w+0HJ+FRUUzsBJixpZuq0\n7xBRgTWmn9MNVW7nqy3p5rkq+OmjY+jk6Rb7B07QGHybKxByfWGtIeazRaxM\n8/ujjoJLJSMmn23CmVW+mQaYU+S3Ct2/NyWGoRIFIH2OKjURzzyB7eQsLiFy\ng62GmoE63E+BoFZ1A0A5umM6Yv2KuhLMq6DnzWjp0nRqatYBjF11RgQgTJmx\nn545e9nFk5GW5adlvtvkCurLc0hCsjp4ebkp7dp056BZuB3k2R9fPuLx1/d+\nlAa7ShK6hkkJECMXzLz9XHRMrypR0+ltTVQ7ddKVsnH+1ObGRHU741eIY6r4\n93Il\r\n=d2Tn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxgMWWUS9JhK1TdLwuJNVS4RzTGfgsuh5fdYD2aTojOQIgORp3IUCF4LqfRrNKoXtw2yhQRaVR4n2hqEPm92nVczw="}]},"_npmUser":{"name":"haijindev","email":"haijin.development@gmail.com"},"directories":{},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-command-line_1.0.0_1605372637528_0.25912811287628923"},"_hasShrinkwrap":false},"1.0.1":{"name":"o-command-line","version":"1.0.1","description":"Utility to execute bash commands","main":"index.js","scripts":{"clean":"rm -rf node_modules && rm -f package-lock.json","test":"npx mocha --config ./utilities-config/.mocharc.json"},"author":{"name":"Martin Rubi"},"license":"ISC","homepage":"https://bitbucket.org/haijin-development/parsed-js","devDependencies":{"chai":"^4.2.0","eslint":"^7.13.0","eslint-config-standard":"^16.0.1","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^5.0.0","o-testing-toolbox":"^2.0.1","mocha":"^7","nyc":"^15.1.0"},"dependencies":{"o-check-list":"^1.0.0","o-toolbox":"^4.0.0"},"gitHead":"f6f73978f72d5d2de44cd15ebdd0ad39847784f4","_id":"o-command-line@1.0.1","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-mHtk7k+kSDtm3ueTVrfti4t8AgRp4myLG9ffyhtw6awbd7SEdjhbqA0rwDrlL/aQhUtUT4d8KT7iMpz0zpN7Pw==","shasum":"7b995c62dbc3ba24f17a5302eb79d246758331a2","tarball":"https://registry.npmjs.org/o-command-line/-/o-command-line-1.0.1.tgz","fileCount":7,"unpackedSize":10918,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf51kECRA9TVsSAnZWagAAUNQP/0Upexr+CT9T8aGsjWGm\nBsqx4HigeqMFNnKDBygp7n97xFCLpW6aq9DYLRhIcRhMTiZSuGjtBVGJ6NL7\n9S2ZAIiOKeRZM9IYcHGpGjvwScJntc1NUHHdNRyCJkcerZJY1OssdFpwM5zD\n/G7/vm+wIrQpcjjdEULNRL6KKKubN2oSfosjEBaW1dtfm8V16DQZuOBlOWbP\neKBto9+nuO3Um1mf9AIk7ArxMdmddYe5awv4npdekzEVj+/wWGZtPhYDpR5A\nfUQtF5FypxYCtWDYNcDrL/TkjPTnmKtT5yUgVyGrH91hHeY25FXNmgMB7GSi\nKZWToKImCOidPAOIeBmInKVJdLWy7/iDfnHz+D8Gd4oAHvPgwh9LufqvuwTi\nx21l3fVtySdEwbnqjlvuNJjMKlBw70BeHudoTd1i7MV4tqCPWRGF37qhibZh\nBRipnW1oOSyedpJIBi9YXKHWPE1dyIx83Lik6A4qbaM6Uxn+Ep6vbze/WUnx\nmvL9iut5Pl9LVMcW/SajPkZ0JEak2qzVCFT9Cega3qO+SxSfzaK9khUIo5ls\nNp0uppPPIBd92w71ZxafKOQvTDLIsSlX/tZ7CFs18VFd4/QCPLMPJXh3Jnug\nVee8Q5T/pmJtYdT/Q+oSfNwCz6ivGluBo//TEdkawvfvaEv7N/tyANYgnnqy\nnj+P\r\n=2mAt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG+3sawxNcZdVfQ0dPXRpHpzCpa2rmkMJqSPL6X9TEnNAiEAhPrump4n3w+FpteS20FOac+aKRmCcFImv/VnlPzMbuE="}]},"_npmUser":{"name":"haijindev","email":"haijin.development@gmail.com"},"directories":{},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-command-line_1.0.1_1608997124304_0.49615051482656924"},"_hasShrinkwrap":false},"1.0.2":{"name":"o-command-line","version":"1.0.2","description":"Utility to execute bash commands","main":"index.js","scripts":{"clean":"rm -rf node_modules && rm -f package-lock.json","test":"npx mocha --config ./utilities-config/.mocharc.json"},"author":{"name":"Martin Rubi"},"license":"ISC","homepage":"https://bitbucket.org/haijin-development/parsed-js","devDependencies":{"chai":"^4.2.0","eslint":"^7.17.0","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","o-testing-toolbox":"^2.0.1","mocha":"^7","nyc":"^15.1.0"},"dependencies":{"o-check-list":"^1.4.1","o-toolbox":"^5.0.0"},"gitHead":"c291efcc08b28199b4c52988524178c960d3f2c7","_id":"o-command-line@1.0.2","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-GeZewis5vOAQQ42Nqve2vtNT8lP+fwQZ7JAv6lieWe+sRo+YXjqg0rQXevES332UC0ff1V6Qy7Mltylo+JMxjA==","shasum":"174ab744fd44fc7e6c0fe714942e4888fc79a1a2","tarball":"https://registry.npmjs.org/o-command-line/-/o-command-line-1.0.2.tgz","fileCount":8,"unpackedSize":11312,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8fnvCRA9TVsSAnZWagAAEvwP/Rm1axRUjHXk5DoZCd8w\nbLtcm+jH8ZMf4iDizk9tiHIk/6EQJluorygmg4ofeIrJsSUM/CsZ7W8Dl8U1\nPyRTp4rkJBp0A7/FpQhOLrtuoxonON/prOJcS6x2hvYE1stI1DwsnSm9rkyP\nJFTEcsFmxgBcRKvfqjnxdGh4u16ot3QUjK3aLGnvlwcNudOst281mY1Q+iuW\nH8YKkrdDDRF20bN6VKTBacYMnHT2dmLJPdrDt/uNjYuEAkBSoJPpXi+TwtMr\ntjgUsXzDPZ7Sh8cMria/X2Cla4A9zOoiWCM7Wy3gXA78NMNllrd5BthcybXu\nIuMibQF1RPAe/FInDYyAcsZzn2A/JcrRWyHUVQG3/AaiMhTK4mlUAfabejJb\nPI0ypMMAzHDu2LMvYEGReB/Pgcqy4NHRfDqF7bQMILi3uxypygZ5eIz50mhr\nhcuFW8HO8OkWxl9ZwAznE90nkMbAkqmfra314EPnRIqDye2Ygd6oSwaA57Vc\nXzlM4VcsrwLuwK16Kuyvy5Uzop7PzBN7j7otpqTq2zFAgYxj/qCJNx7Vav+f\nTu55HSD+dUDHagnaSuKtKJATynh0E73mw4tCviX/8kFMmSAE3axSppoeRtSk\nqLMHKkTMkINb/KaQTsG1UGTuQv1k9yDrn24RQ/RuZAun56DQ2wKTr1jr+9zc\nP2px\r\n=rmCl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJOyqHlCiFamz/Sx3fGRHhmAWGPX0mmh0iRhwdCi5adgIgUpkZKAYC3BC6VHMk66kRms6E/p7HSzkb2oCjPYXFJT4="}]},"_npmUser":{"name":"haijindev","email":"haijin.development@gmail.com"},"directories":{},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-command-line_1.0.2_1609693678957_0.6554216683383149"},"_hasShrinkwrap":false},"1.0.3":{"name":"o-command-line","version":"1.0.3","description":"Utility to execute bash commands","main":"index.js","scripts":{"clean":"rm -rf node_modules && rm -f package-lock.json","test":"npx mocha --config ./utilities-config/.mocharc.json"},"author":{"name":"Martin Rubi"},"license":"ISC","homepage":"http://o-programming-language.org","devDependencies":{"chai":"^4.2.0","eslint":"^7.17.0","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","o-testing-toolbox":"^2.0.1","mocha":"^7","nyc":"^15.1.0"},"dependencies":{"o-check-list":"^1.4.1","o-toolbox":"^5.0.0"},"gitHead":"df0995d995efa5b0397da139ffb4ed3f5fed7804","_id":"o-command-line@1.0.3","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-rt97W5BufQFodFmJd7KdbjzPrULI+/crcMFQHhhs8D6d1yefWGXLQ05ZUSEFpj32UMbWcDnZu8GDsneppgkQHQ==","shasum":"bd21b4e3a3f1ba3d651e9a4d1690032699ddfac5","tarball":"https://registry.npmjs.org/o-command-line/-/o-command-line-1.0.3.tgz","fileCount":8,"unpackedSize":11480,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9MCzCRA9TVsSAnZWagAAZE4P/2F8yLL6gyQ4HPe75eUr\nmJ/Wyx387y0fO8Ha5LBp7G07nNa8loixrtfk1dG7FVSCRiNpZ3DlHt062i/7\nziyG2BOFpJJqSn+t1vEZJvA2vQVbghWlfqV1s7fPr3r7FxowZugm6u/edHxi\nK64b0oIKl0kx7v5sIPfU06ESRxV63aOoa9yYONna6dZlcxix05DK9hF1UyH9\nCr28ahpq8kn220DEm5aoLADWEx5FH/pUU5MOPpWaS4sMi3C0y8HNq1FNAit5\np8KmLK/qaW9JYv+QbwDTgD73tW1pi4r0UfyHJ9+ES6U64CdE+vBcUgaghp+e\nNYe9169PsYmahj861rFiE6wFVX6EwcHSAklMD1hDCOTxGjd76tlF12nJm/bg\n1Pp+rAm0Tw+9WaV9hW3naJe04cROPNnhsKUTxQqP8NTlkueSqFYD/fD+mFxM\nXrSFhG7OU18BZFpz1poMQ6qaR1Gww3gI04KtgEmXtigCUiDbF6yqBXN+yaJC\nrQV9FTT/vi+0HqXOHfqbD+rp27w6QewV74SQg36gze/XQa1Ah7q/xueCAhlu\nrVRyLuJpjECyN4uT/i7Fg60J5a5TFfoseI4Tt81lZkpeeGms/5HYc/7ITICV\nr7MCj29pqGWDOzAUHYsI+Z109ZimhQM++IVVJC5/6p6lrEZXuC2q+O2edTGM\niZSC\r\n=OV+e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD50TzdWib7LKmBsaC0EVuv9llYbZzhrwut3TuvVHCEmgIgBkw20kMufKyOPDBDI5QmaiTJBmyNdSD1v337peXvmJ8="}]},"_npmUser":{"name":"haijindev","email":"haijin.development@gmail.com"},"directories":{},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-command-line_1.0.3_1609875634602_0.6963384104362775"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-08T18:43:24.784Z","0.2.0":"2020-11-08T18:43:24.931Z","modified":"2022-05-12T00:01:26.214Z","1.0.0":"2020-11-14T16:50:37.671Z","1.0.1":"2020-12-26T15:38:44.495Z","1.0.2":"2021-01-03T17:07:59.092Z","1.0.3":"2021-01-05T19:40:34.716Z"},"maintainers":[{"name":"haijindev","email":"haijin.development@gmail.com"}],"description":"Utility to execute bash commands","homepage":"http://o-programming-language.org","author":{"name":"Martin Rubi"},"license":"ISC","readme":"# Command line\n\nUtility to execute bash commands\n\n## Note:\n\nExecuting bash commands from a program is a high security risk\n\nUse a different approach whenever possible\n\n\n## Documentation\n\n[http://o-programming-language.org/](http://o-programming-language.org/)\n\n## Installation\n\n```\nnpm install o-command-line\n```\n\n## Usage\n\n\n```javascript\nconst { CommandLine } = require('o-command-line')\nconst Path = require('o-toolbox/src/Path')\nconst { validation } = require('o-check-list')\n\nclass CopyDirectory extends CommandLine {\n  initialize ({ source, dest }) {\n    this.source = new Path(source)\n    this.dest = new Path(dest)\n  }\n\n  // Validate the parameters\n  // If possible, to prevent code injection validate that parameters are semantically correct,\n  // not just its types and format\n  // This example uses 'o-check-list', but any other validation can be used as well\n  validateParams () {\n    validation((assure) => {\n      assure.that(this.source)\n        .isExistingDirectory()\n      assure.that(this.dest)\n        .isExistingDirectory()\n    })\n  }\n\n  // cp -r \"source/*\" \"dest\"\n  buildCommandString () {\n    return `cp -r \"${ this.source.append('*').toString() }\" \"${ this.dest.toString() }\"`\n  }\n\n  // parse output to convert it to the command result, or throw an error\n  parseCommandOutput ({ stdoutString, stderrString, status, signal, error }) {\n    if ( status !== 0 ) {\n      this.raiseCommandExecutionError({ status, stderrString, error })\n    }\n    return stdoutString\n  }\n}\n\nmodule.exports = CopyDirectory\n```\n\nExecute as the user of the running process\n\n```javascript\nconst command = new CopyDirectory({ source: '.', dest: './copy' })\ncommand.execute()\n```\n\nExecute as a user\n\n```javascript\nconst command = new CopyDirectory({ uid: 1, source: '.', dest: './copy' })\ncommand.execute()\n```\n\nExecute as a group user\n\n```javascript\nconst command = new CopyDirectory({ gid: 1, source: '.', dest: './copy' })\ncommand.execute()\n```\n\nExecute with a timeout expressed in milliseconds\n\n```javascript\nconst command = new CopyDirectory({ timeout: 1000, source: '.', dest: './copy' })\ncommand.execute()\n```\n\nThe execution can be sync or async, calling\n\n```javascript\ncommand.execute()\ncommand.executeAsync()\n```\n\nThe command line is executed in a new, different process and shell each time\nThe process always has the current working directory as its current working directory\nThe process never receives any environment variable or command line input\n\nIf you need to set environment variables, pass command line arguments or change the current working directory, make it part of the command string to mitigate code injection and leaking env vars to a different process\n\n\n```javascript\n// cp -r \"source/*\" \"dest\"\nbuildCommandString () {\n  return `export PATH=\"$(which node):$PATH\" && cd ${this.path} && npm install`\n}\n```\n","readmeFilename":"README.md"}