Skip to content

Commit b93c9ad

Browse files
author
Dom Harrington
committed
Remove unused lib files
1 parent ade0186 commit b93c9ad

File tree

14 files changed

+15
-555
lines changed

14 files changed

+15
-555
lines changed

api.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,15 @@ exports.api = function(args, opts = {}) {
2222
actionObj.run(config, info);
2323
};
2424

25-
exports.load = function(config, action = 'start') {
25+
exports.load = function(config, action = 'help') {
2626
const file = path.join(__dirname, 'lib', `${action}.js`);
27-
if (utils.fileExists(file)) {
27+
try {
2828
// eslint-disable-next-line global-require, import/no-dynamic-require
2929
return require(file);
30+
} catch (e) {
31+
console.error('Action not found.'.red);
32+
console.warn(`Type ${`${config.cli} help`.yellow} to see all commands`);
33+
process.exitCode = 1;
34+
return undefined;
3035
}
31-
32-
const alias = utils.getAliasFile(action);
33-
if (alias) {
34-
// eslint-disable-next-line global-require, import/no-dynamic-require
35-
return require(path.join(__dirname, 'lib', `${alias}.js`));
36-
}
37-
38-
console.error('Action not found.'.red);
39-
console.warn(`Type ${`${config.cli} help`.yellow} to see all commands`);
40-
process.exitCode = 1;
41-
return undefined;
4236
};

lib/add.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/docs.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/endpoint.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

lib/generate.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/help.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
// TODO check this?
12
const glob = require('glob');
23
const path = require('path');
34
const _ = require('lodash');
45

5-
exports.swagger = false;
6-
exports.login = false;
76
exports.category = 'basic';
87
exports.desc = 'Learn what you can do with this tool';
98
exports.weight = 2;
109

1110
function pad(text) {
12-
return `${text} `.substr(0, 15);
11+
return text.padEnd(15);
1312
}
1413

1514
exports.run = function(config) {
1615
console.log('');
17-
console.log(`Usage: ${config.cli} <command> [swagger url]`);
16+
console.log(`Usage: ${config.cli} <command> [arguments]`);
1817
const files = glob.sync(path.join(__dirname, '*'));
1918

2019
const categories = {
@@ -26,10 +25,6 @@ exports.run = function(config) {
2625
desc: `Hosted third-party services ${'(Will post to the Internet)'.grey}`,
2726
commands: [],
2827
},
29-
utility: {
30-
desc: 'Utility functions',
31-
commands: [],
32-
},
3328
};
3429

3530
_.each(files, file => {
@@ -54,10 +49,7 @@ exports.run = function(config) {
5449
});
5550
});
5651

57-
console.log('');
58-
console.log('Just getting started?'.green);
59-
console.log(`Run ${`${config.cli} init`.yellow} to create your Swagger file.`);
6052
console.log('');
6153

62-
process.exit();
54+
process.exitCode = 0;
6355
};

lib/init.js

Lines changed: 0 additions & 189 deletions
This file was deleted.

lib/login.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/manage.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)