cash
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -7,2 +7,4 @@ 'use strict'; | ||
var usage = '-cash: source: filename argument required\nsource: usage: source filename [arguments]'; | ||
var source = { | ||
@@ -24,2 +26,3 @@ exec: function exec(args, options) { | ||
/* istanbul ignore next */ | ||
if (!vorpal) { | ||
@@ -30,3 +33,3 @@ throw new Error('Source is not programatically supported.'); | ||
if (!args.file) { | ||
this.log('-cash: source: filename argument required'); | ||
this.log(usage); | ||
return 2; | ||
@@ -50,3 +53,3 @@ } | ||
} else { | ||
// Some other error | ||
/* istanbul ignore next */ | ||
this.log('-cash: source: unable to read ' + args.file); | ||
@@ -66,3 +69,3 @@ } | ||
vorpal.api.source = source; | ||
vorpal.command('source <file> [params...]').alias('.').parse(preparser).action(function (args, callback) { | ||
vorpal.command('source [file] [params...]').alias('.').parse(preparser).action(function (args, callback) { | ||
args.options = args.options || {}; | ||
@@ -72,2 +75,3 @@ args.options.vorpal = vorpal; | ||
command: source, | ||
args: args, | ||
options: args.options, | ||
@@ -74,0 +78,0 @@ callback: callback |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var commands = ['alias [-p] [name=[value]]', 'cat [-AbeEnstTv] [files ...]', 'cd [dir]', 'clear', 'cp [-fnr] source ... dest', 'echo [-eE] [arg ...]', 'export [-p][id=[value]]', 'false', 'grep [-bHhinqsvw] [-m max] [--silent] [--include pattern] pattern [files ...]', 'head [-n number] [files...]', 'kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l', 'less [files ...]', 'ls [-aAdFhilQrRStUwx1] [paths ...]', 'mkdir [-pv] [directories ...]', 'mv [-fnv] source ... dest', 'pwd [files ...]', 'rm [-frR] [files ...]', 'sort [-chMnrR] [-o file] [files ...]', 'source filename [arguments...]', 'tail [options] <files ...>', 'touch [-acm] [-d date] [-r ref] [--time word] file ...', 'true', 'unalias [-a] name [names ...]']; | ||
var commands = ['alias [-p] [name=[value]]', 'cat [-AbeEnstTv] [files ...]', 'cd [dir]', 'clear', 'cp [-fnr] source ... dest', 'echo [-eE] [arg ...]', 'export [-p][id=[value]]', 'false', 'grep [-bHhinqsvw] [-m max] [--silent] [--include pattern] pattern [files ...]', 'head [-nqv] <files ...>', 'kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l', 'less [files ...]', 'ls [-aAdFhilQrRStUwx1] [paths ...]', 'mkdir [-pv] [directories ...]', 'mv [-fnv] source ... dest', 'pwd [files ...]', 'rm [-frR] [files ...]', 'sort [-chMnrR] [-o file] [files ...]', 'source filename [arguments...]', 'tail [options] <files ...>', 'touch [-acm] [-d date] [-r ref] [--time word] file ...', 'true', 'unalias [-a] name [names ...]']; | ||
@@ -8,0 +8,0 @@ function chop(str, len) { |
"use strict"; | ||
module.exports = "\nUsage: head [OPTION] [files ...]\nShow first lines of file(s).\n\nReport head bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n"; | ||
module.exports = "\nUsage: head [OPTION]... [FILE]...\nPrint the first 10 lines of each FILE to standard output.\nWith more than one FILE, precede each with a header giving the file name.\nWith no FILE, or when FILE is -, read standard input.\n\n -n, --lines <number> output the last N lines, instead of the last 10\n -q, --silent suppresses printing of headers when multiple files\n are being examined\n -v, --verbose always output headers giving file names\n --help display this help and exit\n\nReport head bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n"; |
@@ -189,12 +189,21 @@ 'use strict'; | ||
// Load rcFile upon startup | ||
var rcFile = path.join(delimiter.getHomeDir(), process.platform === 'win32' ? '_cashrc' : '.cashrc'); | ||
/* instanbul ignore next */ | ||
try { | ||
if (!fs.statSync(rcFile).isDirectory()) { | ||
/* instanbul ignore next */ | ||
app.vorpal.execSync('source ' + rcFile); | ||
// Load .cashrc upon startup | ||
var locations = ['.cashrc']; | ||
if (process.platform === 'win32') { | ||
/* istanbul ignore next */ | ||
locations.push('_cashrc'); | ||
} | ||
locations = locations.map(function (str) { | ||
return path.join(delimiter.getHomeDir(), str); | ||
}); | ||
for (var i = 0; i < locations.length; ++i) { | ||
try { | ||
if (!fs.statSync(locations[i]).isDirectory()) { | ||
app.vorpal.execSync('source ' + locations[i]); | ||
break; | ||
} | ||
} catch (e) { | ||
// File doesn't exist, so just don't load defaults | ||
} | ||
} catch (e) { | ||
// File doesn't exist, so just don't load defaults | ||
} | ||
@@ -201,0 +210,0 @@ |
{ | ||
"name": "cash", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Cross-platform Linux commands in pure ES6.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -155,2 +155,3 @@ <h1 align="center"> | ||
- sort | ||
- source | ||
- tail | ||
@@ -178,3 +179,3 @@ - touch | ||
- [@nfischer](https://github.com/nfischer): Added `export`, `true` and `false` commands, among several other contributions. | ||
- [@nfischer](https://github.com/nfischer): Added `source`, `export`, `true` and `false` commands, among several other contributions. | ||
- [@safinn](https://github.com/safinn): Added `clear` and `tail` commands. | ||
@@ -181,0 +182,0 @@ - [@legien](https://github.com/legien): Added `head` command. |
AI detected security risk
Supply chain riskAI has determined that this package may contain potential security issues or vulnerabilities.
Found 1 instance in 1 package
165469
4010
230
4