Skip to content

Commit

Permalink
Remove unused packages and simplify a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed May 1, 2018
1 parent b93c9ad commit 810c7ee
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 870 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#! /usr/bin/env node
const _ = require('lodash');

const parseArgs = require('minimist')(process.argv.slice(2));

const args = parseArgs._;
const opts = _.clone(parseArgs);
delete opts._;

require('./api').api(args, opts);
require('./api').api(parseArgs._, parseArgs);
16 changes: 9 additions & 7 deletions lib/help.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// TODO check this?
const glob = require('glob');
const path = require('path');
const _ = require('lodash');
const fs = require('fs');

exports.category = 'basic';
exports.desc = 'Learn what you can do with this tool';
Expand All @@ -14,7 +12,10 @@ function pad(text) {
exports.run = function(config) {
console.log('');
console.log(`Usage: ${config.cli} <command> [arguments]`);
const files = glob.sync(path.join(__dirname, '*'));
const files = fs
.readdirSync(__dirname)
.filter(file => file.endsWith('.js'))
.map(file => path.join(__dirname, file));

const categories = {
basic: {
Expand All @@ -27,7 +28,7 @@ exports.run = function(config) {
},
};

_.each(files, file => {
files.forEach(file => {
const action = file.match(/(\w+).js/)[1];
// eslint-disable-next-line global-require, import/no-dynamic-require
const f = require(file);
Expand All @@ -41,10 +42,11 @@ exports.run = function(config) {
}
});

_.each(categories, category => {
Object.keys(categories).forEach(key => {
const category = categories[key];
console.log('');
console.log(category.desc);
_.each(_.sortBy(category.commands, 'weight'), command => {
category.commands.sort((a, b) => a.weight > b.weight).forEach(command => {
console.log(command.text);
});
});
Expand Down
Loading

0 comments on commit 810c7ee

Please sign in to comment.