@@ -7,14 +7,16 @@ const cliOptions = [
7
7
{ name : "module" , alias : "m" , type : Boolean } ,
8
8
{ name : "output" , alias : "o" , type : String } ,
9
9
{ name : "input" , alias : "i" , type : String } ,
10
- { name : "spawn" , type : Boolean }
10
+ { name : "spawn" , type : Boolean } ,
11
+ { name : "source" , type : String }
11
12
] ;
12
13
const args = cliParser ( cliOptions ) ;
13
14
if ( ! ( "standalone" in args ) ) args . standalone = false ;
14
15
if ( ! ( "module" in args ) ) args . module = false ;
15
16
if ( ! ( "output" in args ) ) args . output = null ;
16
17
if ( ! ( "input" in args ) ) args . input = null ;
17
18
if ( ! ( "spawn" in args ) ) args . spawn = false ;
19
+ if ( ! ( "source" in args ) ) args . source = null ;
18
20
function inputSource ( input , callback ) {
19
21
fs . readFile ( input , function ( error , buffer ) {
20
22
if ( error ) throw error ;
@@ -51,6 +53,8 @@ function compile(source) {
51
53
if ( args . input !== null ) {
52
54
if ( args . output !== null ) console . log ( "Opening " + args . input + " for compilation." ) ;
53
55
inputSource ( args . input , compile ) ;
56
+ } else if ( args . source ) {
57
+ compile ( args . source ) ;
54
58
} else {
55
59
stdInSource ( compile ) ;
56
60
}
0 commit comments