77
88@click .group ()
99def cli ():
10- """XBasic CLI tool. """
10+ """XBasic Shell """
1111 pass
1212
1313
@@ -33,26 +33,30 @@ def entry_shell():
3333
3434
3535@cli .command ()
36- @click .option ('-f' , type = click .Path (exists = True ), default = None , help = 'Specify a file to execute within the shell.' )
37- def shell (f ):
38- """Start an interactive shell or execute a file within the shell."""
36+ def shell ():
37+ """Start an interactive shell"""
3938 print_intro ()
40- if f :
41- if not f .endswith ('.bsx' ):
42- click .echo ("Error: File must end with '.bsx'." )
43- return
44- result , error = run ('<stdin>' , f'RUN("{ f } ")' )
45- if error :
46- print (error .as_string ())
47- elif result :
48- print ("The process returned " , result )
49- else :
50- entry_shell ()
39+ entry_shell ()
40+
41+
42+ @cli .command ()
43+ @click .option ('-f' , type = click .Path (exists = True ), required = True , default = None ,
44+ help = 'Specify a file to execute within the shell.' )
45+ def file (f ):
46+ """Execute a file within the shell"""
47+ if not f .endswith ('.bsx' ):
48+ click .echo ("Error: File must end with '.bsx'." )
49+ return
50+ result , error = run ('<stdin>' , f'RUN("{ f } ")' )
51+ if error :
52+ print (error .as_string ())
53+ elif result :
54+ print ("The process returned " , result )
5155
5256
5357def print_intro ():
5458 """Print introductory information."""
55- version = "1.2.1 "
59+ version = "1.2.2 "
5660 current_date_time = datetime .datetime .now ().strftime ("%b %d %Y, %H:%M:%S" )
5761 os_name = platform .system ()
5862 intro = f"XBasic { version } ({ current_date_time } ) on { os_name .lower ()} "
0 commit comments