File tree 3 files changed +30
-13
lines changed
3 files changed +30
-13
lines changed Original file line number Diff line number Diff line change 11
11
def create_convert_subparser (
12
12
parser : argparse .ArgumentParser ,
13
13
) -> argparse .ArgumentParser :
14
- parser .add_argument (
14
+ config_file = parser .add_argument (
15
15
dest = "config_file" ,
16
16
type = str ,
17
17
metavar = "config-file" ,
18
18
help = "checks tmuxp and current directory for config files." ,
19
19
)
20
+ try :
21
+ import shtab
22
+
23
+ config_file .complete = shtab .FILE # type: ignore
24
+ except ImportError :
25
+ pass
26
+
20
27
parser .add_argument (
21
28
"--yes" ,
22
29
"-y" ,
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def create_import_subparser(
81
81
)
82
82
83
83
import_teamocilgroup = import_teamocil .add_mutually_exclusive_group (required = True )
84
- import_teamocilgroup .add_argument (
84
+ teamocil_config_file = import_teamocilgroup .add_argument (
85
85
dest = "config_file" ,
86
86
type = str ,
87
87
nargs = "?" ,
@@ -99,7 +99,7 @@ def create_import_subparser(
99
99
import_tmuxinatorgroup = import_tmuxinator .add_mutually_exclusive_group (
100
100
required = True
101
101
)
102
- import_tmuxinatorgroup .add_argument (
102
+ tmuxinator_config_file = import_tmuxinatorgroup .add_argument (
103
103
dest = "config_file" ,
104
104
type = str ,
105
105
nargs = "?" ,
@@ -111,6 +111,14 @@ def create_import_subparser(
111
111
callback = command_import_tmuxinator , import_subparser_name = "tmuxinator"
112
112
)
113
113
114
+ try :
115
+ import shtab
116
+
117
+ teamocil_config_file .complete = shtab .FILE # type: ignore
118
+ tmuxinator_config_file .complete = shtab .FILE # type: ignore
119
+ except ImportError :
120
+ pass
121
+
114
122
return parser
115
123
116
124
Original file line number Diff line number Diff line change @@ -515,14 +515,6 @@ def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
515
515
help = "passthru to tmux(1) -f" ,
516
516
)
517
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
-
526
518
parser .add_argument (
527
519
"-s" ,
528
520
dest = "new_session_name" ,
@@ -566,14 +558,24 @@ def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
566
558
const = 88 ,
567
559
help = "like -2, but indicates that the terminal supports 88 colours." ,
568
560
)
569
-
570
561
parser .set_defaults (colors = None )
571
- parser .add_argument (
562
+
563
+ log_file = parser .add_argument (
572
564
"--log-file" ,
573
565
metavar = "file_path" ,
574
566
action = "store" ,
575
567
help = "file to log errors/output to" ,
576
568
)
569
+
570
+ try :
571
+ import shtab
572
+
573
+ config_file .complete = shtab .FILE # type: ignore
574
+ tmux_config_file .complete = shtab .FILE # type: ignore
575
+ log_file .complete = shtab .FILE # type: ignore
576
+ except ImportError :
577
+ pass
578
+
577
579
return parser
578
580
579
581
You can’t perform that action at this time.
0 commit comments