File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,34 @@ fn run_main() -> Result<()> {
160160 ) ;
161161 }
162162
163- let args = Cli :: parse ( ) ;
163+ use std:: env;
164+ let mut raw_args: Vec < String > = env:: args ( ) . collect ( ) ;
165+
166+ if !raw_args. is_empty ( ) {
167+ raw_args. remove ( 0 ) ;
168+ }
169+
170+ // If no arguments, alias to `repl`
171+ let args = if raw_args. is_empty ( ) {
172+ Cli {
173+ command : Command :: Repl {
174+ expose_internals : false ,
175+ print_internals : false ,
176+ disable_gc : false ,
177+ } ,
178+ }
179+ } else if raw_args. len ( ) == 1 && raw_args[ 0 ] . ends_with ( ".ts" ) {
180+ // If a single .ts file is provided, alias to `run file.ts`
181+ Cli {
182+ command : Command :: Run {
183+ verbose : false ,
184+ no_strict : false ,
185+ paths : vec ! [ raw_args[ 0 ] . clone( ) ] ,
186+ } ,
187+ }
188+ } else {
189+ Cli :: parse ( )
190+ } ;
164191
165192 let rt = tokio:: runtime:: Builder :: new_current_thread ( )
166193 . enable_time ( )
You can’t perform that action at this time.
0 commit comments