@@ -393,49 +393,29 @@ def command_freeze(args):
393
393
394
394
def command_load (args ):
395
395
"""Load a session from a tmuxp session file."""
396
- if args .list :
397
- startup (config_dir )
398
- configs_in_user = config .in_dir (config_dir )
399
- configs_in_cwd = config .in_cwd ()
400
-
401
- sys .exit ()
402
396
403
- output = ''
397
+ if isinstance (args .config , list ):
398
+ args .config = ' ' .join (args .config )
404
399
405
- if not configs_in_user :
406
- output += '# %s: \n \t None found.\n ' % config_dir
400
+ if '.' == args .config :
401
+ if config .in_cwd ():
402
+ configfile = config .in_cwd ()[0 ]
403
+ print (configfile )
407
404
else :
408
- output += '# %s: \n \t %s\n ' % (
409
- config_dir , ', ' .join (configs_in_user )
410
- )
411
-
412
- if configs_in_cwd :
413
- output += '# current directory:\n \t %s' % (
414
- ', ' .join (configs_in_cwd )
415
- )
405
+ sys .exit ('No tmuxp configs found in current directory.' )
406
+ else :
407
+ configfile = args .config
416
408
417
- print ( output )
418
- return
409
+ file_user = os . path . join ( config_dir , configfile )
410
+ file_cwd = os . path . join ( cwd_dir , configfile )
419
411
420
- elif args .config :
421
- if '.' == args .config :
422
- if config .in_cwd ():
423
- configfile = config .in_cwd ()[0 ]
424
- print (configfile )
425
- else :
426
- sys .exit ('No tmuxp configs found in current directory.' )
427
- else :
428
- configfile = args .config
429
- file_user = os .path .join (config_dir , configfile )
430
- file_cwd = os .path .join (cwd_dir , configfile )
431
-
432
- if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
433
- print ('load %s' % file_cwd )
434
- load_workspace (file_cwd , args )
435
- elif os .path .exists (file_user ) and os .path .isfile (file_user ):
436
- load_workspace (file_user , args )
437
- else :
438
- logger .error ('%s not found.' % configfile )
412
+ if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
413
+ print ('load %s' % file_cwd )
414
+ load_workspace (file_cwd , args )
415
+ elif os .path .exists (file_user ) and os .path .isfile (file_user ):
416
+ load_workspace (file_user , args )
417
+ else :
418
+ logger .error ('%s not found.' % configfile )
439
419
440
420
441
421
def command_import_teamocil (args ):
@@ -847,16 +827,10 @@ def get_parser():
847
827
'already exists, offer to attach instead.'
848
828
)
849
829
850
- loadgroup = load .add_mutually_exclusive_group (required = True )
851
- loadgroup .add_argument (
852
- '--list' , dest = 'list' , action = 'store_true' ,
853
- help = 'List config files available' ,
854
- )
855
-
856
- loadgroup .add_argument (
830
+ load .add_argument (
857
831
dest = 'config' ,
858
832
type = str ,
859
- nargs = '? ' ,
833
+ nargs = '+ ' ,
860
834
help = 'List config available in working directory and config folder.'
861
835
).completer = ConfigFileCompleter (
862
836
allowednames = ('.yaml' , '.json' ), directories = False
0 commit comments