@@ -178,6 +178,26 @@ def subcommand_load(args):
178
178
logger .error ('%s not found.' % configfile )
179
179
180
180
181
+ def subcommand_convert (args ):
182
+ if args .configs :
183
+ if '.' in args .configs :
184
+ args .configs .remove ('.' )
185
+ if config .in_cwd ():
186
+ args .configs .append (config .in_cwd ()[0 ])
187
+ else :
188
+ print ('No tmuxp configs found in current directory.' )
189
+
190
+ for configfile in args .configs :
191
+ file_user = os .path .join (config_dir , configfile )
192
+ file_cwd = os .path .join (cwd_dir , configfile )
193
+ if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
194
+ print file_cwd
195
+ elif os .path .exists (file_user ) and os .path .isfile (file_user ):
196
+ print file_uesr
197
+ else :
198
+ logger .error ('%s not found.' % configfile )
199
+
200
+
181
201
def subcommand_attach_session (args ):
182
202
commands = []
183
203
try :
@@ -268,10 +288,29 @@ def cli_parser():
268
288
$ tmuxp .
269
289
270
290
will check launch a ~/.pullv.yaml / ~/.pullv.json from the cwd.
291
+ will also check for any ./*.yaml and ./*.json.
271
292
''' % (cwd_dir + '/' , config_dir )
272
293
)
273
294
load .set_defaults (callback = subcommand_load )
274
295
296
+ convert = subparsers .add_parser ('convert' )
297
+
298
+ convert .add_argument (
299
+ dest = 'configs' ,
300
+ nargs = '*' ,
301
+ type = str ,
302
+ default = None ,
303
+ help = '''\
304
+ Checks current working directory (%s) then $HOME/.tmuxp directory (%s).
305
+
306
+ $ tmuxp .
307
+
308
+ will check launch a ~/.pullv.yaml / ~/.pullv.json from the cwd.
309
+ will also check for any ./*.yaml and ./*.json.
310
+ ''' % (cwd_dir + '/' , config_dir )
311
+ )
312
+ convert .set_defaults (callback = subcommand_convert )
313
+
275
314
parser .add_argument ('--log-level' , dest = 'log_level' , default = 'INFO' ,
276
315
metavar = 'log-level' ,
277
316
help = 'Log level e.g. INFO, DEBUG, ERROR' )
@@ -302,7 +341,7 @@ def main():
302
341
logger .error (e )
303
342
sys .exit ()
304
343
305
- oh_my_zsh_auto_title ()
344
+ util . oh_my_zsh_auto_title ()
306
345
307
346
if args .callback is subcommand_load :
308
347
subcommand_load (args )
@@ -337,7 +376,7 @@ def complete(cline, cpoint):
337
376
ctext = cline .replace ('tmuxp ' , '' )
338
377
339
378
commands = []
340
- commands .extend (['attach-session' , 'kill-session' , 'load' ])
379
+ commands .extend (['attach-session' , 'kill-session' , 'load' , 'convert' ])
341
380
342
381
commands = [c for c in commands if ctext in c ]
343
382
@@ -375,23 +414,6 @@ def config_complete(command, commands, ctext):
375
414
session_complete ('attach-session' , commands , ctext )
376
415
session_complete ('kill-session' , commands , ctext )
377
416
config_complete ('load' , commands , ctext )
417
+ config_complete ('convert' , commands , ctext )
378
418
379
419
print (' \n ' .join (commands ))
380
-
381
-
382
- def oh_my_zsh_auto_title ():
383
- '''give warning and offer to fix DISABLE_AUTO_TITLE
384
-
385
- see: https://github.com/robbyrussell/oh-my-zsh/pull/257
386
- '''
387
-
388
- if 'SHELL' in os .environ and 'zsh' in os .environ .get ('SHELL' ):
389
- if os .path .exists (os .path .expanduser ('~/.oh-my-zsh' )):
390
- # oh-my-zsh exists
391
- if 'DISABLE_AUTO_TITLE' not in os .environ or os .environ .get ('DISABLE_AUTO_TITLE' ) == "false" :
392
- print ('Please set:\n \n '
393
- '\t export DISABLE_AUTO_TITLE = \' true\' \n \n '
394
- 'in ~/.zshrc or where your zsh profile is stored.\n '
395
- 'Remember the "export" at the beginning!\n \n '
396
- 'Then create a new shell or type:\n \n '
397
- '\t $ source ~/.zshrc' )
0 commit comments