Skip to content

Commit adc7e30

Browse files
committed
wip. going to experiment with argcomplete again
1 parent b9e7a2d commit adc7e30

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

tmuxp/cli.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,21 @@ def subcommand_load(args):
162162
print(output)
163163

164164
elif args.config:
165-
if '.' in args.config:
166-
args.config.remove('.')
165+
if '.' == args.config:
167166
if config.in_cwd():
168167
args.config.append(config.in_cwd()[0])
169168
else:
170169
print('No tmuxp configs found in current directory.')
171170

172-
for configfile in args.config:
173-
file_user = os.path.join(config_dir, configfile)
174-
file_cwd = os.path.join(cwd_dir, configfile)
175-
if os.path.exists(file_cwd) and os.path.isfile(file_cwd):
176-
build_workspace(file_cwd, args)
177-
elif os.path.exists(file_user) and os.path.isfile(file_user):
178-
build_workspace(file_user, args)
179-
else:
180-
logger.error('%s not found.' % configfile)
171+
configfile = args.config
172+
file_user = os.path.join(config_dir, configfile)
173+
file_cwd = os.path.join(cwd_dir, configfile)
174+
if os.path.exists(file_cwd) and os.path.isfile(file_cwd):
175+
build_workspace(file_cwd, args)
176+
elif os.path.exists(file_user) and os.path.isfile(file_user):
177+
build_workspace(file_user, args)
178+
else:
179+
logger.error('%s not found.' % configfile)
181180

182181

183182
def subcommand_import_teamocil(args):
@@ -587,6 +586,14 @@ def config_complete(command, commands, ctext):
587586
ctext_subargs = ctext.replace(command + ' ', '')
588587
configs = []
589588

589+
# if ctext_subargs.startswith('.') or ctext_subargs.startswith('/'):
590+
# configs += ['.hi']
591+
592+
# if ctext_subargs.endswith('/') and ctext_subargs != './':
593+
# configs += ['./' + c for c in config.in_dir(os.path.relpath(ctext_subargs))]
594+
# else:
595+
# configs += os.listdir(os.path.relpath(ctext_subargs))
596+
590597
configs += ['./' + c for c in config.in_dir(cwd_dir)]
591598
configs += ['./' + c for c in config.in_cwd()]
592599
configs += [os.path.join(config_dir, c)

0 commit comments

Comments
 (0)