File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ var fs = require('fs');
22var util = require ( 'util' ) ;
33
44var _ = require ( 'underscore' ) ;
5+ var childProcess = require ( 'child_process' ) ;
56
67var h = require ( '../helper' ) ;
78var chalk = require ( '../chalk' ) ;
@@ -45,6 +46,12 @@ var cmd = {
4546 type : 'boolean' ,
4647 default : false ,
4748 describe : 'Show code template'
49+ } ,
50+ editor : {
51+ alias : 'e' ,
52+ type : 'string' ,
53+ default : '' ,
54+ describe : 'Pass generated source file to editor'
4855 }
4956 }
5057} ;
@@ -71,6 +78,13 @@ cmd.handler = function(argv) {
7178 filename = problem . id + '.' + problem . slug + '.' + ( i ++ ) + h . langToExt ( argv . lang ) ;
7279
7380 core . exportProblem ( problem , filename , ! argv . extra ) ;
81+
82+ if ( argv . editor ) {
83+ childProcess . spawn ( argv . editor , [ filename ] , {
84+ // in case your editor of choice is vim or emacs
85+ stdio : 'inherit'
86+ } ) ;
87+ }
7488 }
7589
7690 if ( argv . desc ) {
You can’t perform that action at this time.
0 commit comments