UNPKG

696 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _isWindows = require('is-windows');
8
9var _isWindows2 = _interopRequireDefault(_isWindows);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13exports.default = commandConvert;
14
15/**
16 * Converts an environment variable usage to be appropriate for the current OS
17 * @param {String} command Command to convert
18 * @returns {String} Converted command
19 */
20
21function commandConvert(command) {
22 if (!(0, _isWindows2.default)()) {
23 return command;
24 }
25 var envUnixRegex = /\$(\w+)|\${(\w+)}/g; // $my_var or ${my_var}
26 return command.replace(envUnixRegex, '%$1$2%');
27}
\No newline at end of file