Skip to content

Commit cf95b23

Browse files
committed
Add lib/help.js
1 parent f7223e2 commit cf95b23

File tree

8 files changed

+39
-0
lines changed

8 files changed

+39
-0
lines changed

lib/docs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var request = require('request');
22

33
exports.swagger = true;
44
exports.login = true;
5+
exports.desc = "Upload your docs to ReadMe.io";
56

67
exports.run = function(config, info) {
78
console.log('Uploading Swagger file...');

lib/generate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
exports.swagger = true;
22
exports.login = false;
3+
exports.desc = "Output your Swagger file";
34

45
exports.run = function(config, info) {
56
console.log(JSON.stringify(info.swagger, undefined, 2));

lib/help.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var glob = require('glob');
2+
var path = require('path');
3+
var _ = require('lodash');
4+
5+
exports.swagger = false;
6+
exports.login = false;
7+
exports.desc = "Learn what you can do with api";
8+
9+
exports.run = function(config, info) {
10+
console.log("");
11+
console.log("Here's a list of what you can do with " + 'api'.yellow + ":");
12+
console.log("");
13+
var files = glob.sync(path.join(__dirname, "*"));
14+
15+
_.each(files, function(file) {
16+
var action = file.match(/(\w+).js/)[1];
17+
var info = require(file).desc || "";
18+
console.log(" $".grey + pad(" api " + action) + " " + info.grey);
19+
});
20+
21+
console.log("");
22+
console.log("Just getting started?".green);
23+
console.log("Run " + "api init".yellow + " to create your Swagger file.");
24+
console.log("");
25+
26+
function pad(text) {
27+
return (text + " ").substr(0,15)
28+
}
29+
};

lib/host.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var request = require('request');
22

33
exports.swagger = true;
44
exports.login = true;
5+
exports.desc = "Get a public URL for your API";
56

67
exports.run = function(config, info) {
78
console.log('Uploading Swagger file...');

lib/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var utils = require('../utils');
77

88
exports.swagger = false;
99
exports.login = false;
10+
exports.desc = "Create a new API specification";
1011

1112
var types = [
1213
{ "name": "application/json", "checked": true },

lib/login.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
var jsonfile = require('jsonfile')
22
var open = require('open');
33

4+
exports.swagger = false;
5+
exports.login = false;
6+
exports.desc = "Authenticate this computer";
7+
48
exports.run = function(config, info) {
59
if(info.args[1] == 'info') {
610
try {

lib/mock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var request = require('request');
33

44
exports.swagger = true;
55
exports.login = true;
6+
exports.desc = "Run a mock server based on your API";
67

78
exports.run = function(config, info) {
89
console.log('Uploading Swagger file...');

lib/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
exports.swagger = true;
22
exports.login = true;
3+
exports.desc = "Internal use, will be deleted soon :)";
34

45
exports.run = function(config, info) {
56
console.log('SWAGGER', info.swagger);

0 commit comments

Comments
 (0)