@@ -3,6 +3,7 @@ import { RunCommand } from "../../engine/run_command";
33import { RunResult } from "../../engine/run_result" ;
44import { WikiRunner } from "../../engine/wikiRunner" ;
55import * as path from "path" ;
6+ import * as fs from 'fs' ;
67
78export class WikiConsole extends WikiRunner {
89
@@ -126,5 +127,26 @@ export class WikiConsole extends WikiRunner {
126127 this . renderWiki ( path . join ( this . getRunnerDirectory ( ) , "templates" , "createDevon4jProject.asciidoc" ) , { name : runCommand . command . parameters [ 0 ] } ) ;
127128 return null ;
128129 }
130+
131+ runNextKatacodaStep ( runCommand : RunCommand ) : RunResult {
132+ let tempFile = path . join ( this . getTempDirectory ( ) , runCommand . command . name + ".md" ) ;
133+ fs . writeFileSync ( tempFile , "" ) ;
134+ for ( let i = 0 ; i < runCommand . command . parameters [ 1 ] . length ; i ++ ) {
135+ let param = runCommand . command . parameters [ 1 ] [ i ] ;
136+ if ( param . content ) {
137+ fs . appendFileSync ( tempFile , param . content ) ;
138+ } else if ( param . file ) {
139+ fs . appendFileSync ( tempFile , fs . readFileSync ( path . join ( this . playbookPath , param . file ) , "utf-8" ) ) ;
140+ } else if ( param . image ) {
141+ let image = path . join ( this . playbookPath , param . image ) ;
142+ fs . appendFileSync ( tempFile , " + ")" ) ;
143+ }
144+ fs . appendFileSync ( tempFile , "\n\n" ) ;
145+ }
146+
147+ let content = fs . readFileSync ( tempFile , "utf-8" ) ;
148+ this . renderWiki ( path . join ( this . getRunnerDirectory ( ) , "templates" , "nextKatacodaStep.asciidoc" ) , { title : runCommand . command . parameters [ 0 ] , content : content , path : runCommand . command . parameters [ 2 ] } ) ;
149+ return null ;
150+ }
129151}
130152
0 commit comments