diff options
| author | Priyansh <[email protected]> | 2020-12-22 17:50:12 +0530 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2020-12-22 17:50:12 +0530 |
| commit | 22dc033f4938d6a19e086a1cbd36ec5cade5eaab (patch) | |
| tree | 9feb963ccd5c1581e676e41004801abc67db3357 /node_modules/node-cmd | |
| parent | e93da8b04da86773247aadb1cbb1912e4f4526b2 (diff) | |
| download | styx-22dc033f4938d6a19e086a1cbd36ec5cade5eaab.tar.xz styx-22dc033f4938d6a19e086a1cbd36ec5cade5eaab.zip | |
Remove node_modules
Diffstat (limited to 'node_modules/node-cmd')
| -rw-r--r-- | node_modules/node-cmd/.npmignore | 1 | ||||
| -rw-r--r-- | node_modules/node-cmd/README.md | 158 | ||||
| -rw-r--r-- | node_modules/node-cmd/cmd.js | 32 | ||||
| -rw-r--r-- | node_modules/node-cmd/commandline.js | 27 | ||||
| -rw-r--r-- | node_modules/node-cmd/example/basic.js | 28 | ||||
| -rw-r--r-- | node_modules/node-cmd/example/example.created.file | 0 | ||||
| -rw-r--r-- | node_modules/node-cmd/example/getPID.js | 4 | ||||
| -rw-r--r-- | node_modules/node-cmd/example/nodePythonTerminal.js | 27 | ||||
| -rw-r--r-- | node_modules/node-cmd/licence.md | 27 | ||||
| -rw-r--r-- | node_modules/node-cmd/package.json | 58 |
10 files changed, 0 insertions, 362 deletions
diff --git a/node_modules/node-cmd/.npmignore b/node_modules/node-cmd/.npmignore deleted file mode 100644 index 8a4f50a..0000000 --- a/node_modules/node-cmd/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/example/node-cmd/ diff --git a/node_modules/node-cmd/README.md b/node_modules/node-cmd/README.md deleted file mode 100644 index 3afbf7a..0000000 --- a/node_modules/node-cmd/README.md +++ /dev/null @@ -1,158 +0,0 @@ -# node-cmd - -*Node.js commandline/terminal interface.* - -Simple commandline or terminal interface to allow you to run cli or bash style commands as if you were in the terminal. - -Run commands asynchronously, and if needed can get the output as a string. - -#### NPM Stats - -npm info : -[](https://nodei.co/npm/node-cmd/) -[See npm trends and stats for node-cmd](http://npm-stat.com/charts.html?package=node-cmd&author=&from=&to=) -     - -[](https://github.com/RIAEvangelist) - -GitHub info : -   - -Package details websites : -* [GitHub.io site](http://riaevangelist.github.io/node-cmd/ "node-cmd documentation"). A prettier version of this site. -* [NPM Module](https://www.npmjs.org/package/node-cmd "node-cmd npm module"). The npm page for the node-cmd module. - -This work is licenced via the [DBAD Public Licence](http://www.dbad-license.org/). - - -# Methods - -|method | arguments | functionality | -|-------|-----------|---------------| -|run | command | runs a command asynchronously| -|get | command,callback | runs a command asynchronously, when the command is complete all of the stdout will be passed to the callback| - - -## Examples - -```javascript - - var cmd=require('node-cmd'); - - cmd.get( - 'pwd', - function(err, data, stderr){ - console.log('the current working dir is : ',data) - } - ); - - cmd.run('touch example.created.file'); - - cmd.get( - 'ls', - function(err, data, stderr){ - console.log('the current dir contains these files :\n\n',data) - } - ); - - cmd.get( - ` - git clone https://github.com/RIAEvangelist/node-cmd.git - cd node-cmd - ls - `, - function(err, data, stderr){ - if (!err) { - console.log('the node-cmd cloned dir contains these files :\n\n',data) - } else { - console.log('error', err) - } - - } - ); - -``` - -## With promises - -this example by @stephen-last - -``` javascript - -import Promise from 'bluebird' -import cmd from 'node-cmd' - -const getAsync = Promise.promisify(cmd.get, { multiArgs: true, context: cmd }) - -getAsync('node -v').then(data => { - console.log('cmd data', data) -}).catch(err => { - console.log('cmd err', err) -}) - -``` - -## Accessing the CMD Process -If you need PIDs, stdio,stdin, stdout, stderr, etc. access, for use in your code, or cleaning up, @freemany added in some functionality to get a reference to the child process as the returned value of the ` get ` and ` run ` calls. - - -### Getting Process ID - -```javascript - - var cmd=require('../cmd.js'); - - var process=cmd.get('node'); - console.log(process.pid); - -``` - -### Running a python shell from node - -```javascript -const cmd=require('../cmd.js'); - -const processRef=cmd.get('python -i'); -let data_line = ''; - -//listen to the python terminal output -processRef.stdout.on( - 'data', - function(data) { - data_line += data; - if (data_line[data_line.length-1] == '\n') { - console.log(data_line); - } - } -); - -const pythonTerminalInput=`primes = [2, 3, 5, 7] -for prime in primes: - print(prime) - -`; - -//show what we are doing -console.log(`>>>${pythonTerminalInput}`); - -//send it to the open python terminal -processRef.stdin.write(pythonTerminalInput); - -``` - -Output : - -```python - ->>>primes = [2, 3, 5, 7] -for prime in primes: - print(prime) - - -2 -3 -5 -7 - - -``` diff --git a/node_modules/node-cmd/cmd.js b/node_modules/node-cmd/cmd.js deleted file mode 100644 index 4cc4a1d..0000000 --- a/node_modules/node-cmd/cmd.js +++ /dev/null @@ -1,32 +0,0 @@ -var exec = require('child_process').exec; - -var commandline={ - get:getString, - run:runCommand -}; - -function runCommand(command){ - //return refrence to the child process - return exec( - command - ); -} - -function getString(command,callback){ - //return refrence to the child process - return exec( - command, - ( - function(){ - return function(err,data,stderr){ - if(!callback) - return; - - callback(err, data, stderr); - } - } - )(callback) - ); -} - -module.exports=commandline; diff --git a/node_modules/node-cmd/commandline.js b/node_modules/node-cmd/commandline.js deleted file mode 100644 index 425ea97..0000000 --- a/node_modules/node-cmd/commandline.js +++ /dev/null @@ -1,27 +0,0 @@ -var exec = require('child_process').exec; - -var commandline={ - get:getString, - run:runCommand -}; - -function runCommand(command){ - exec( - command - ); -} - -function getString(command,callback){ - exec( - command, - ( - function(){ - return function(err,data,stderr){ - callback(data,err,stderr); - } - } - )(callback) - ); -} - -module.exports=commandline; diff --git a/node_modules/node-cmd/example/basic.js b/node_modules/node-cmd/example/basic.js deleted file mode 100644 index 66fcc54..0000000 --- a/node_modules/node-cmd/example/basic.js +++ /dev/null @@ -1,28 +0,0 @@ -var cmd=require('../cmd.js'); - -cmd.get( - 'pwd', - function(data){ - console.log('the current working dir is : ',data) - } -); - -cmd.run('touch example.created.file'); - -cmd.get( - 'ls', - function(data){ - console.log('the current dir contains these files :\n\n',data) - } -); - -cmd.get( - ` - git clone https://github.com/RIAEvangelist/node-cmd.git - cd node-cmd - ls - `, - function(data){ - console.log('the node-cmd clone dir contains these files :\n\n',data) - } -); diff --git a/node_modules/node-cmd/example/example.created.file b/node_modules/node-cmd/example/example.created.file deleted file mode 100644 index e69de29..0000000 --- a/node_modules/node-cmd/example/example.created.file +++ /dev/null diff --git a/node_modules/node-cmd/example/getPID.js b/node_modules/node-cmd/example/getPID.js deleted file mode 100644 index e5946d4..0000000 --- a/node_modules/node-cmd/example/getPID.js +++ /dev/null @@ -1,4 +0,0 @@ -var cmd=require('../cmd.js'); - -var processRef=cmd.get('node'); -console.log(processRef.pid); diff --git a/node_modules/node-cmd/example/nodePythonTerminal.js b/node_modules/node-cmd/example/nodePythonTerminal.js deleted file mode 100644 index 59d16e2..0000000 --- a/node_modules/node-cmd/example/nodePythonTerminal.js +++ /dev/null @@ -1,27 +0,0 @@ -const cmd=require('../cmd.js'); - -const processRef=cmd.get('python -i'); -let data_line = ''; - -//listen to the python terminal output -processRef.stdout.on( - 'data', - function(data) { - data_line += data; - if (data_line[data_line.length-1] == '\n') { - console.log(data_line); - } - } -); - -const pythonTerminalInput=`primes = [2, 3, 5, 7] -for prime in primes: - print(prime) - -`; - -//show what we are doing -console.log(`>>>${pythonTerminalInput}`); - -//send it to the open python terminal -processRef.stdin.write(pythonTerminalInput); diff --git a/node_modules/node-cmd/licence.md b/node_modules/node-cmd/licence.md deleted file mode 100644 index 9169a8f..0000000 --- a/node_modules/node-cmd/licence.md +++ /dev/null @@ -1,27 +0,0 @@ -# DON'T BE A DICK PUBLIC LICENSE - -> Version 1, December 2009 - -> Copyright (C) 2009 Philip Sturgeon <[email protected]> - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - -> DON'T BE A DICK PUBLIC LICENSE -> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 1. Do whatever you like with the original work, just don't be a dick. - - Being a dick includes - but is not limited to - the following instances: - - 1a. Outright copyright infringement - Don't just copy this and change the name. - 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick. - 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick. - - 2. If you become rich through modifications, related works/services, or supporting the original work, - share the love. Only a dick would make loads off this work and not buy the original work's - creator(s) a pint. - - 3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes - you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back. diff --git a/node_modules/node-cmd/package.json b/node_modules/node-cmd/package.json deleted file mode 100644 index 330e1b5..0000000 --- a/node_modules/node-cmd/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "_from": "node-cmd@^3.0.0", - "_id": "[email protected]", - "_inBundle": false, - "_integrity": "sha1-OP/3CkqqT2WdID61eGJzcBjiT28=", - "_location": "/node-cmd", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-cmd@^3.0.0", - "name": "node-cmd", - "escapedName": "node-cmd", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/node-cmd/-/node-cmd-3.0.0.tgz", - "_shasum": "38fff70a4aaa4f659d203eb57862737018e24f6f", - "_spec": "node-cmd@^3.0.0", - "_where": "/Users/lucifer/Documents/styx", - "author": { - "name": "Brandon Nozaki Miller" - }, - "bugs": { - "url": "https://github.com/RIAEvangelist/node-cmd/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Simple commandline/terminal interface to allow you to run cli or bash style commands as if you were in the terminal.", - "directories": { - "example": "example" - }, - "homepage": "https://github.com/RIAEvangelist/node-cmd", - "keywords": [ - "commandline", - "terminal", - "cmd", - "cli", - "bash", - "script", - "node" - ], - "license": "DBAD", - "main": "cmd.js", - "name": "node-cmd", - "repository": { - "type": "git", - "url": "git+https://github.com/RIAEvangelist/node-cmd.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "3.0.0" -} |
