Comparing version 0.2.1 to 0.3.0
const fse = require('fs-extra') | ||
const path = require('path') | ||
const { isDirectory, pathExists, warn } = require('../_utils.js') | ||
const { isDirectory, pathExists, warn } = require('../utils.js') | ||
@@ -32,7 +32,10 @@ async function createPath (filepath) { | ||
/* | ||
hey create dir/file.txt | ||
hey create deep/dir/that/doesnt/exist | ||
hey create file.txt other-file.txt in dir | ||
hey create file.txt in dir/that/doesnt/exist | ||
/** | ||
* Create new files/directories | ||
* | ||
* @example | ||
* hey create dir/file.txt | ||
* hey create deep/dir/that/doesnt/exist | ||
* hey create file.txt other-file.txt in dir | ||
* hey create file.txt in dir/that/doesnt/exist | ||
*/ | ||
@@ -39,0 +42,0 @@ module.exports = async function (command) { |
const trash = require('trash') | ||
const { resolveGlobs } = require('../_utils.js') | ||
const { resolveGlobs } = require('../utils.js') | ||
/* | ||
hey delete 'dir/*.txt' | ||
hey delete '*.txt' from dir | ||
hey delete '*.txt' in dir | ||
/** | ||
* Move files/directories to trash | ||
* | ||
* @example | ||
* hey delete 'dir/*.txt' | ||
* hey delete '*.txt' from dir | ||
* hey delete '*.txt' in dir | ||
*/ | ||
@@ -9,0 +12,0 @@ module.exports = async function (command) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @alias remove | ||
*/ | ||
module.exports = require('./_remove.js') |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @alias list | ||
*/ | ||
module.exports = require('./_list.js') |
const { relative } = require('path') | ||
const { resolveGlobs } = require('../_utils.js') | ||
const { resolveGlobs } = require('../utils.js') | ||
/* | ||
hey list '*.txt' | ||
hey list '*.txt' in some/dir | ||
hey list '*.txt' from some/dir | ||
/** | ||
* @example | ||
* hey list '*.txt' | ||
* hey list '*.txt' in some/dir | ||
* hey list '*.txt' from some/dir | ||
*/ | ||
@@ -9,0 +10,0 @@ module.exports = async function (command) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @alias create | ||
*/ | ||
module.exports = require('./_create.js') |
const fse = require('fs-extra') | ||
const { resolveGlobs } = require('../_utils.js') | ||
const { resolveGlobs } = require('../utils.js') | ||
/* | ||
hey remove 'dir/*.txt' | ||
hey remove '*.txt' from dir | ||
hey remove '*.txt' in dir | ||
/** | ||
* Remove files/directories (**does not move to trash; | ||
* use #delete or #trash for that**) | ||
* | ||
* @example | ||
* hey remove 'dir/*.txt' | ||
* hey remove '*.txt' from dir | ||
* hey remove '*.txt' in dir | ||
*/ | ||
@@ -9,0 +13,0 @@ module.exports = async function (command) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @alias delete | ||
*/ | ||
module.exports = require('./_delete.js') |
@@ -1,3 +0,6 @@ | ||
/* | ||
hey where am i | ||
/** | ||
* Print current working directory | ||
* | ||
* @example | ||
* hey where am i | ||
*/ | ||
@@ -4,0 +7,0 @@ module.exports = function (command) { |
@@ -8,2 +8,3 @@ module.exports = { | ||
make: require('./_make.js'), | ||
move: require('./_move.js'), | ||
remove: require('./_remove.js'), | ||
@@ -10,0 +11,0 @@ trash: require('./_trash.js'), |
const commands = require('./commands/index.js') | ||
const parseCommand = require('./parse-command.js') | ||
const { isArray, isString } = require('./_utils.js') | ||
const { isArray, isString } = require('./utils.js') | ||
@@ -5,0 +5,0 @@ async function hey (input, options = {}) { |
@@ -0,2 +1,5 @@ | ||
const { kebabToCamel } = require('./utils.js') | ||
const MODIFIERS = ['from', 'in', 'into', 'to'] | ||
const FLAG_REGEX = /^--.+/ | ||
@@ -6,2 +9,3 @@ module.exports = function parseCommand (args) { | ||
args: [], | ||
flags: {}, | ||
mods: {}, | ||
@@ -14,3 +18,8 @@ type: args[0] | ||
if (arg) { | ||
if (MODIFIERS.includes(arg)) { | ||
if (FLAG_REGEX.test(arg)) { | ||
let [ key, value ] = arg.slice(2).split('=') | ||
key = kebabToCamel(key) | ||
result.flags[key] = value || true | ||
} else if (MODIFIERS.includes(arg)) { | ||
result.mods[arg] = args[i + 1] | ||
@@ -17,0 +26,0 @@ args[i + 1] = false |
{ | ||
"name": "heycli", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A human-readable interface for terminal commands", | ||
@@ -42,7 +42,14 @@ "keywords": [ | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls", | ||
"docs": "node generate-docs.js", | ||
"lint": "standard '*(lib|test)/**/*.js' --verbose | snazzy", | ||
"prepush": "npm run lint", | ||
"test": "mocha --recursive -R list -t 5s", | ||
"test": "ava -v", | ||
"test+coverage": "nyc npm test" | ||
}, | ||
"ava": { | ||
"require": "esm" | ||
}, | ||
"nyc": { | ||
"require": "esm" | ||
}, | ||
"standard": { | ||
@@ -58,6 +65,7 @@ "env": "mocha" | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"ava": "^0.25.0", | ||
"coveralls": "^3.0.0", | ||
"doctrine": "^2.1.0", | ||
"esm": "^3.0.84", | ||
"husky": "^0.14.3", | ||
"mocha": "^5.0.5", | ||
"nyc": "^11.7.1", | ||
@@ -64,0 +72,0 @@ "snazzy": "^7.1.1", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11804
18
307
8
5
1