Skip to content

Commit d477b2b

Browse files
committed
cli optimizations, accept 1 arg for kill-session, attach-session, import command, wip
1 parent a2c2b60 commit d477b2b

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

tmuxp/cli.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ def subcommand_load(args):
178178
logger.error('%s not found.' % configfile)
179179

180180

181+
def subcommand_import_teamocil(args):
182+
print(args)
183+
184+
185+
def subcommand_import_tmuxinator(args):
186+
print(args)
187+
188+
181189
def subcommand_convert(args):
182190
if args.configs:
183191
if '.' in args.configs:
@@ -284,7 +292,6 @@ def cli_parser():
284292
''',
285293
)
286294

287-
parser = argparse.ArgumentParser()
288295
subparsers = parser.add_subparsers(title='subcommands',
289296
description='valid subcommands',
290297
help='additional help')
@@ -294,7 +301,7 @@ def cli_parser():
294301

295302
kill_session.add_argument(
296303
dest='session_name',
297-
nargs='*',
304+
nargs=1,
298305
type=str,
299306
default=None,
300307
)
@@ -304,7 +311,7 @@ def cli_parser():
304311

305312
attach_session.add_argument(
306313
dest='session_name',
307-
nargs='*',
314+
nargs=1,
308315
type=str,
309316
default=None,
310317
)
@@ -317,7 +324,7 @@ def cli_parser():
317324

318325
load.add_argument(
319326
dest='configs',
320-
nargs='*',
327+
nargs=1,
321328
type=str,
322329
default=None,
323330
help='''\
@@ -337,7 +344,7 @@ def cli_parser():
337344

338345
convert.add_argument(
339346
dest='configs',
340-
nargs='*',
347+
nargs=1,
341348
type=str,
342349
default=None,
343350
help='''\
@@ -351,6 +358,37 @@ def cli_parser():
351358
)
352359
convert.set_defaults(callback=subcommand_convert)
353360

361+
importparser = subparsers.add_parser('import')
362+
importsubparser = importparser.add_subparsers(title='subcommands',
363+
description='valid subcommands',
364+
help='additional help')
365+
366+
import_teamocil = importsubparser.add_parser('teamocil')
367+
368+
import_teamocil.add_argument(
369+
dest='config',
370+
nargs=1,
371+
type=str,
372+
default=None,
373+
help='''\
374+
Checks current ~/.teamocil and current directory for yaml files.
375+
'''
376+
)
377+
import_teamocil.set_defaults(callback=subcommand_import_teamocil)
378+
379+
import_tmuxinator = importsubparser.add_parser('tmuxinator')
380+
381+
import_tmuxinator.add_argument(
382+
dest='config',
383+
nargs=1,
384+
type=str,
385+
default=None,
386+
help='''\
387+
Checks current ~/.tmuxinator and current directory for yaml files.
388+
'''
389+
)
390+
import_tmuxinator.set_defaults(callback=subcommand_import_tmuxinator)
391+
354392
parser.add_argument('--log-level', dest='log_level', default='INFO',
355393
metavar='log-level',
356394
help='Log level e.g. INFO, DEBUG, ERROR')

0 commit comments

Comments
 (0)