@@ -354,8 +354,10 @@ def cli_parser():
354354 parser .add_argument ('-S' , dest = 'socket_path' , default = None ,
355355 metavar = 'socket-path' )
356356
357+ # http://stackoverflow.com/questions/8521612/argparse-optional-subparser
357358 parser .add_argument (
358- '-v' , '--version' , dest = 'version' , action = 'store_true' ,
359+ '-v' , '--version' , action = 'version' ,
360+ version = 'tmuxp %s' % __version__ ,
359361 help = 'Prints the tmuxp version' )
360362
361363 return parser
@@ -368,7 +370,7 @@ def main():
368370 args = parser .parse_args ()
369371
370372 setupLogger (level = args .log_level .upper ())
371- logger . error ( 'hi' )
373+
372374 try :
373375 util .version ()
374376 except Exception as e :
@@ -377,7 +379,10 @@ def main():
377379
378380 util .oh_my_zsh_auto_title ()
379381
380- if args .callback is subcommand_load :
382+ print (args )
383+ if args .version :
384+ print ('tmuxp %s' % __version__ )
385+ elif args .callback is subcommand_load :
381386 subcommand_load (args )
382387 elif args .callback is subcommand_convert :
383388 subcommand_convert (args )
@@ -386,9 +391,6 @@ def main():
386391 elif args .callback is subcommand_kill_session :
387392 subcommand_kill_session (args )
388393 else :
389- if args .version :
390- print ('tmuxp %s' % __version__ )
391-
392394 parser .print_help ()
393395
394396
0 commit comments