Skip to content

Commit bf7ccab

Browse files
committed
feat(cli): Add shtab completions
1 parent c86168e commit bf7ccab

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/tmuxp/cli/load.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def config_file_completion(ctx, params, incomplete):
488488

489489

490490
def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
491-
parser.add_argument(
491+
config_file = parser.add_argument(
492492
"config_file",
493493
metavar="config-file",
494494
help="filepath to session or filename of session if in tmuxp config directory",
@@ -508,12 +508,21 @@ def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
508508
help="passthru to tmux(1) -S",
509509
)
510510

511-
parser.add_argument(
511+
tmux_config_file = parser.add_argument(
512512
"-f",
513513
dest="tmux_config_file",
514514
metavar="tmux_config_file",
515515
help="passthru to tmux(1) -f",
516516
)
517+
518+
try:
519+
import shtab
520+
521+
config_file.complete = shtab.FILE # type: ignore
522+
tmux_config_file.complete = shtab.FILE # type: ignore
523+
except ImportError:
524+
pass
525+
517526
parser.add_argument(
518527
"-s",
519528
dest="new_session_name",

0 commit comments

Comments
 (0)