Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
346 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 | var shebangRegex = require('shebang-regex');
|
---|
| 3 |
|
---|
| 4 | module.exports = function (str) {
|
---|
| 5 | var match = str.match(shebangRegex);
|
---|
| 6 |
|
---|
| 7 | if (!match) {
|
---|
| 8 | return null;
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | var arr = match[0].replace(/#! ?/, '').split(' ');
|
---|
| 12 | var bin = arr[0].split('/').pop();
|
---|
| 13 | var arg = arr[1];
|
---|
| 14 |
|
---|
| 15 | return (bin === 'env' ?
|
---|
| 16 | arg :
|
---|
| 17 | bin + (arg ? ' ' + arg : '')
|
---|
| 18 | );
|
---|
| 19 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.