1+ /* eslint-disable */
12var data = null ;
23var filter = "" ;
34var converter = new showdown . Converter ( ) ;
@@ -8,7 +9,9 @@ var sepVersion = "@";
89var template =
910 '<p class="cmd-title">@@main-cmd@@</p><p class="cmd-description">@@cmd-description@@</p><p> </p><p>Options:</p>@@options@@<p> </p>' ;
1011var optionTemplate =
11- '<p>@@option@@</p><p class="cmd-description">@@description@@</p><div class="line-space"></div>' ;
12+ '<p>@@option@@</p><p class="cmd-description">@@description@@</p>@@inherit@@<div class="line-space"></div>' ;
13+ var inheritTemplate =
14+ '<p class="cmd-inherit">inherit @@inherit@@ from spk config.yaml</p>' ;
1215var relTemplate =
1316 '<li><a class="preserve-view button is-small has-border-none has-inner-focus has-flex-justify-content-start is-full-width has-text-wrap is-text-left">@@value@@</a></li>' ;
1417
@@ -19,18 +22,18 @@ function sanitize(str) {
1922function getExistingVersions ( ) {
2023 $ . ajax ( {
2124 url : "releases.txt" ,
22- success : function ( result ) {
23- result . split ( "\n" ) . forEach ( function ( r ) {
25+ success : function ( result ) {
26+ result . split ( "\n" ) . forEach ( function ( r ) {
2427 var rTrim = r . trim ( ) ;
2528 if ( rTrim && releases . indexOf ( rTrim ) === - 1 ) {
2629 releases . push ( rTrim ) ;
2730 }
2831 } ) ;
29- releases . sort ( function ( a , b ) {
32+ releases . sort ( function ( a , b ) {
3033 return a > b ? - 1 : 1 ;
3134 } ) ;
3235 } ,
33- async : false
36+ async : false ,
3437 } ) ;
3538}
3639
@@ -56,8 +59,8 @@ function populateVersionList() {
5659 return a + relTemplate . replace ( "@@value@@" , c ) ;
5760 } , "" )
5861 ) ;
59- oSelect . find ( "li" ) . each ( function ( i , elm ) {
60- $ ( elm ) . on ( "click" , function ( evt ) {
62+ oSelect . find ( "li" ) . each ( function ( i , elm ) {
63+ $ ( elm ) . on ( "click" , function ( evt ) {
6164 evt . stopPropagation ( ) ;
6265 oSelect . css ( "display" , "none" ) ;
6366 var ver = $ ( this ) . text ( ) ;
@@ -91,15 +94,27 @@ function showDetails(key) {
9194 ) ;
9295 content = content . replace ( "@@cmd-description@@" , cmd . description ) ;
9396
94- var options = ( cmd . options || [ ] ) . reduce ( function ( a , c ) {
95- a + = optionTemplate
97+ var options = ( cmd . options || [ ] ) . reduce ( function ( a , c ) {
98+ var o = optionTemplate
9699 . replace ( "@@option@@" , sanitize ( c . arg ) )
97100 . replace ( "@@description@@" , sanitize ( c . description ) ) ;
101+
102+ if ( c . inherit ) {
103+ o = o . replace (
104+ "@@inherit@@" ,
105+ inheritTemplate . replace ( "@@inherit@@" , c . inherit )
106+ ) ;
107+ } else {
108+ o = o . replace ( "@@inherit@@" , "" ) ;
109+ }
110+
111+ a += o ;
98112 return a ;
99113 } , "" ) ;
100114 options += optionTemplate
101115 . replace ( "@@option@@" , "-h, --help" )
102- . replace ( "@@description@@" , "output usage information" ) ;
116+ . replace ( "@@description@@" , "output usage information" )
117+ . replace ( "@@inherit@@" , "" ) ;
103118
104119 content = content . replace ( "@@options@@" , options ) ;
105120
@@ -121,11 +136,11 @@ function showDetails(key) {
121136function populateListing ( ) {
122137 var cmdKeys = Object . keys ( data ) ;
123138 if ( filter ) {
124- cmdKeys = cmdKeys . filter ( function ( k ) {
139+ cmdKeys = cmdKeys . filter ( function ( k ) {
125140 return k . indexOf ( filter ) !== - 1 ;
126141 } ) ;
127142 }
128- var listing = cmdKeys . reduce ( function ( a , c ) {
143+ var listing = cmdKeys . reduce ( function ( a , c ) {
129144 a +=
130145 "<li><a href=\"javascript:showDetails('" +
131146 c +
@@ -159,32 +174,29 @@ function populateListing() {
159174 }
160175}
161176
162- var subheaderItems = function ( ) {
163- $ ( "#item_share" ) . click ( function ( evt ) {
177+ var subheaderItems = function ( ) {
178+ $ ( "#item_share" ) . click ( function ( evt ) {
164179 evt . stopPropagation ( ) ;
165180 $ ( "#sharing-menu" ) . css ( "display" , "block" ) ;
166181 } ) ;
167- $ ( "body" ) . click ( function ( ) {
182+ $ ( "body" ) . click ( function ( ) {
168183 $ ( "#sharing-menu" ) . css ( "display" , "none" ) ;
169184 } ) ;
170- $ ( "#item_contribute" ) . click ( function ( evt ) {
185+ $ ( "#item_contribute" ) . click ( function ( evt ) {
171186 var win = window . open ( "https://github.com/CatalystCode/spk" , "_blank" ) ;
172187 win . focus ( ) ;
173188 } ) ;
174189} ;
175190
176191function loadCommands ( ) {
177192 var url = version === "master" ? "./data.json" : "./data" + version + ".json" ;
178- $ . getJSON ( url , function ( json ) {
193+ $ . getJSON ( url , function ( json ) {
179194 data = json ;
180195 subheaderItems ( ) ;
181196 populateListing ( ) ;
182197
183- $ ( "#commandfilter" ) . on ( "input" , function ( ) {
184- filter = $ ( this )
185- . val ( )
186- . trim ( )
187- . toLowerCase ( ) ;
198+ $ ( "#commandfilter" ) . on ( "input" , function ( ) {
199+ filter = $ ( this ) . val ( ) . trim ( ) . toLowerCase ( ) ;
188200 populateListing ( ) ;
189201 } ) ;
190202 } ) ;
@@ -206,15 +218,15 @@ function showReleaseSelector(bShow) {
206218 }
207219}
208220
209- $ ( function ( ) {
210- $ ( "#btnSelectRelease" ) . on ( "click" , function ( evt ) {
221+ $ ( function ( ) {
222+ $ ( "#btnSelectRelease" ) . on ( "click" , function ( evt ) {
211223 evt . stopPropagation ( ) ;
212224 showReleaseSelector ( ) ;
213225 } ) ;
214- $ ( document . body ) . on ( "click" , function ( ) {
226+ $ ( document . body ) . on ( "click" , function ( ) {
215227 showReleaseSelector ( false ) ;
216228 } ) ;
217- $ ( document ) . keyup ( function ( evt ) {
229+ $ ( document ) . keyup ( function ( evt ) {
218230 if ( evt . keyCode === 27 ) {
219231 showReleaseSelector ( false ) ;
220232 }
0 commit comments