@@ -22,6 +22,23 @@ export class PDKFeature implements IFeature {
2222 } ) ,
2323 ) ;
2424 logger . debug ( 'Registered ' + PDKCommandStrings . PdkNewModuleCommandId + ' command' ) ;
25+
26+ [
27+ { id : 'puppet.pdkValidate' , request : 'pdk validate' , type : 'validate' } ,
28+ { id : 'puppet.pdkTestUnit' , request : 'pdk test unit' , type : 'test' } ,
29+ ] . forEach ( ( command ) => {
30+ context . subscriptions . push (
31+ vscode . commands . registerCommand ( command . id , ( ) => {
32+ this . terminal . sendText ( command . request ) ;
33+ this . terminal . show ( ) ;
34+ if ( reporter ) {
35+ reporter . sendTelemetryEvent ( command . id ) ;
36+ }
37+ } ) ,
38+ ) ;
39+ logger . debug ( `Registered ${ command . id } command` ) ;
40+ } ) ;
41+
2542 context . subscriptions . push (
2643 vscode . commands . registerCommand ( PDKCommandStrings . PdkNewClassCommandId , ( ) => {
2744 this . pdkNewClassCommand ( ) ;
@@ -40,18 +57,6 @@ export class PDKFeature implements IFeature {
4057 } ) ,
4158 ) ;
4259 logger . debug ( 'Registered ' + PDKCommandStrings . PdkNewTaskCommandId + ' command' ) ;
43- context . subscriptions . push (
44- vscode . commands . registerCommand ( PDKCommandStrings . PdkValidateCommandId , ( ) => {
45- this . pdkValidateCommand ( ) ;
46- } ) ,
47- ) ;
48- logger . debug ( 'Registered ' + PDKCommandStrings . PdkValidateCommandId + ' command' ) ;
49- context . subscriptions . push (
50- vscode . commands . registerCommand ( PDKCommandStrings . PdkTestUnitCommandId , ( ) => {
51- this . pdkTestUnitCommand ( ) ;
52- } ) ,
53- ) ;
54- logger . debug ( 'Registered ' + PDKCommandStrings . PdkTestUnitCommandId + ' command' ) ;
5560 }
5661
5762 public dispose ( ) : any {
@@ -142,20 +147,4 @@ export class PDKFeature implements IFeature {
142147 }
143148 } ) ;
144149 }
145-
146- private pdkValidateCommand ( ) {
147- this . terminal . sendText ( `pdk validate` ) ;
148- this . terminal . show ( ) ;
149- if ( reporter ) {
150- reporter . sendTelemetryEvent ( PDKCommandStrings . PdkValidateCommandId ) ;
151- }
152- }
153-
154- private pdkTestUnitCommand ( ) {
155- this . terminal . sendText ( `pdk test unit` ) ;
156- this . terminal . show ( ) ;
157- if ( reporter ) {
158- reporter . sendTelemetryEvent ( PDKCommandStrings . PdkTestUnitCommandId ) ;
159- }
160- }
161150}
0 commit comments