Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
lib/ | 12-May-2024 | - | 52 | 45 | ||
LICENSE | D | 12-May-2024 | 756 | 16 | 12 | |
README.md | D | 12-May-2024 | 1.1 KiB | 45 | 32 | |
index.js | D | 12-May-2024 | 7.2 KiB | 266 | 176 | |
package.json | D | 12-May-2024 | 1.5 KiB | 61 | 60 |
README.md
1 # cmd-shim 2 3 The cmd-shim used in npm to create executable scripts on Windows, 4 since symlinks are not suitable for this purpose there. 5 6 On Unix systems, you should use a symbolic link instead. 7 8 [](https://travis-ci.org/npm/cmd-shim) 9 [](https://david-dm.org/npm/cmd-shim) 10 [](https://www.npmjs.com/package/cmd-shim) 11 12 ## Installation 13 14 ``` 15 npm install cmd-shim 16 ``` 17 18 ## API 19 20 ### cmdShim(from, to, cb) 21 22 Create a cmd shim at `to` for the command line program at `from`. 23 e.g. 24 25 ```javascript 26 var cmdShim = require('cmd-shim'); 27 cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', function (err) { 28 if (err) throw err; 29 }); 30 ``` 31 32 ### cmdShim.ifExists(from, to, cb) 33 34 The same as above, but will just continue if the file does not exist. 35 Source: 36 37 ```javascript 38 function cmdShimIfExists (from, to, cb) { 39 fs.stat(from, function (er) { 40 if (er) return cb() 41 cmdShim(from, to, cb) 42 }) 43 } 44 ``` 45