@@ -25,6 +25,10 @@ def parse_args(in_args):
2525 parser .add_argument ('--baudrate' , type = int , default = 115200 , help = 'Serial baudrate' )
2626 parser .add_argument ('--timeout' , type = int , default = 3 ,
2727 help = 'Serial communication timeout in seconds' )
28+ parser .add_argument ('--debug' , action = 'store_true' ,
29+ help = 'Enable debug logging' )
30+ parser .add_argument ('--cmd-type' , choices = ['at' , 'shell' , 'auto' ], default = 'auto' ,
31+ help = 'Command type to use. "at" for AT commands, "shell" for shell commands, "auto" to detect automatically.' )
2832
2933 subparsers = parser .add_subparsers (
3034 title = 'subcommands' , dest = 'subcommand' , help = 'Certificate related commands'
@@ -127,15 +131,22 @@ def exit_with_msg(exitcode, msg):
127131 exit (exitcode )
128132
129133def main (args , credstore ):
130- credstore .command_interface .detect_shell_mode ()
134+ if args .cmd_type == 'auto' :
135+ credstore .command_interface .detect_shell_mode ()
136+ elif args .cmd_type == 'shell' :
137+ credstore .command_interface .set_shell_mode (True )
131138 credstore .command_interface .enable_error_codes ()
132139 exec_cmd (args , credstore )
133140
134141def run (argv = sys .argv ):
135- logging .basicConfig (level = 'DEBUG' )
136142 args = parse_args (argv [1 :])
137143 comms = None
138144
145+ if args .debug :
146+ logging .basicConfig (level = 'DEBUG' )
147+ else :
148+ logging .basicConfig (level = 'ERROR' )
149+
139150 # Use inquirer to find the device
140151 if args .dev == 'auto' :
141152 comms = Comms (list_all = True , baudrate = args .baudrate , timeout = args .timeout )
0 commit comments