• Home
Name Date Size #Lines LOC

..--

lib/12-May-2024-5245

LICENSED12-May-2024756 1612

README.mdD12-May-20241.1 KiB4532

index.jsD12-May-20247.2 KiB266176

package.jsonD12-May-20241.5 KiB6160

README.md

1# cmd-shim
2
3The cmd-shim used in npm to create executable scripts on Windows,
4since symlinks are not suitable for this purpose there.
5
6On Unix systems, you should use a symbolic link instead.
7
8[![Build Status](https://img.shields.io/travis/npm/cmd-shim/master.svg)](https://travis-ci.org/npm/cmd-shim)
9[![Dependency Status](https://img.shields.io/david/npm/cmd-shim.svg)](https://david-dm.org/npm/cmd-shim)
10[![NPM version](https://img.shields.io/npm/v/cmd-shim.svg)](https://www.npmjs.com/package/cmd-shim)
11
12## Installation
13
14```
15npm install cmd-shim
16```
17
18## API
19
20### cmdShim(from, to, cb)
21
22Create a cmd shim at `to` for the command line program at `from`.
23e.g.
24
25```javascript
26var cmdShim = require('cmd-shim');
27cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', function (err) {
28  if (err) throw err;
29});
30```
31
32### cmdShim.ifExists(from, to, cb)
33
34The same as above, but will just continue if the file does not exist.
35Source:
36
37```javascript
38function cmdShimIfExists (from, to, cb) {
39  fs.stat(from, function (er) {
40    if (er) return cb()
41    cmdShim(from, to, cb)
42  })
43}
44```
45