File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change
1
+ var colors = require ( 'colors' ) ;
2
+ var utils = require ( '../utils' ) ;
3
+
4
+ exports . swagger = false ;
5
+ exports . login = false ;
6
+ exports . category = "basic" ;
7
+ exports . desc = "Learn how to document an endpoint" ;
8
+ exports . weight = 3 ;
9
+
10
+ exports . run = function ( config , info ) {
11
+ console . log ( "You can document each endpoint right above the code. Just use the" ) ;
12
+ console . log ( "following syntax in a comment above the code:" ) ;
13
+ console . log ( "" ) ;
14
+
15
+ console . log ( utils . swaggerInlineExample ( utils . guessLanguage ( ) ) ) ;
16
+
17
+ console . log ( '' ) ;
18
+ console . log ( 'Param shorthand: ' . blue + 'Since params are very verbose, we have a shorthand' ) ;
19
+ console . log ( 'for describing them.' ) ;
20
+
21
+ console . log ( '' ) ;
22
+ console . log ( ' - (in) name=default* {type:format} description' . grey ) ;
23
+ console . log ( '' ) ;
24
+
25
+ console . log ( "This will be expanded when the Swagger file is compiled." ) ;
26
+
27
+ console . log ( '' ) ;
28
+ console . log ( 'For more information on this syntax, see https://github.com/readmeio/swagger-inline' ) ;
29
+
30
+ process . exit ( ) ;
31
+ } ;
32
+
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ exports.swagger = false;
6
6
exports . login = false ;
7
7
exports . category = "basic" ;
8
8
exports . desc = "Learn what you can do with oai" ;
9
+ exports . weight = 2 ;
9
10
10
11
exports . run = function ( config , info ) {
11
12
console . log ( "" ) ;
@@ -33,15 +34,18 @@ exports.run = function(config, info) {
33
34
var info = f . desc || "" ;
34
35
35
36
if ( f . category ) {
36
- categories [ f . category ] . commands . push ( " $" . grey + pad ( " oai " + action ) + " " + info . grey ) ;
37
+ categories [ f . category ] . commands . push ( {
38
+ text : " $" . grey + pad ( " oai " + action ) + " " + info . grey ,
39
+ weight : f . weight ,
40
+ } ) ;
37
41
}
38
42
} ) ;
39
43
40
44
_ . each ( categories , function ( category ) {
41
45
console . log ( "" ) ;
42
46
console . log ( category . desc ) ;
43
- _ . each ( category . commands , function ( command ) {
44
- console . log ( command ) ;
47
+ _ . each ( _ . sortBy ( category . commands , 'weight' ) , function ( command ) {
48
+ console . log ( command . text ) ;
45
49
} ) ;
46
50
} ) ;
47
51
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ exports.swagger = false;
10
10
exports . login = false ;
11
11
exports . category = "basic" ;
12
12
exports . desc = "Create a new API specification" ;
13
+ exports . weight = 0 ;
13
14
14
15
var types = [
15
16
{ "name" : "application/json" , "checked" : true } ,
You can’t perform that action at this time.
0 commit comments