1+ import argparse
12import os
2-
3- import click
3+ import typing as t
44
55from libtmux import Server
66
77from .. import util
88from .._compat import PY3 , PYMINOR
99
1010
11- @click .command (name = "shell" )
12- @click .argument ("session_name" , nargs = 1 , required = False )
13- @click .argument ("window_name" , nargs = 1 , required = False )
14- @click .option ("-S" , "socket_path" , help = "pass-through for tmux -S" )
15- @click .option ("-L" , "socket_name" , help = "pass-through for tmux -L" )
16- @click .option (
17- "-c" ,
18- "command" ,
19- help = "Instead of opening shell, execute python code in libtmux and exit" ,
20- )
21- @click .option (
22- "--best" ,
23- "shell" ,
24- flag_value = "best" ,
25- help = "Use best shell available in site packages" ,
26- default = True ,
27- )
28- @click .option ("--pdb" , "shell" , flag_value = "pdb" , help = "Use plain pdb" )
29- @click .option ("--code" , "shell" , flag_value = "code" , help = "Use stdlib's code.interact()" )
30- @click .option (
31- "--ptipython" , "shell" , flag_value = "ptipython" , help = "Use ptpython + ipython"
32- )
33- @click .option ("--ptpython" , "shell" , flag_value = "ptpython" , help = "Use ptpython" )
34- @click .option ("--ipython" , "shell" , flag_value = "ipython" , help = "Use ipython" )
35- @click .option ("--bpython" , "shell" , flag_value = "bpython" , help = "Use bpython" )
36- @click .option (
37- "--use-pythonrc/--no-startup" ,
38- "use_pythonrc" ,
39- help = "Load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code" ,
40- default = False ,
41- )
42- @click .option (
43- "--use-vi-mode/--no-vi-mode" ,
44- "use_vi_mode" ,
45- help = "Use vi-mode in ptpython/ptipython" ,
46- default = False ,
47- )
11+ def create_shell_subparser (parser : argparse .ArgumentParser ) -> argparse .ArgumentParser :
12+ parser .add_argument (
13+ "config" ,
14+ help = "Filepath to session or filename of session if in tmuxp config directory" ,
15+ )
16+ parser .add_argument ("session_name" , nargs = 1 , required = False )
17+ parser .add_argument ("window_name" , nargs = 1 , required = False )
18+ parser .add_argument ("-S" , "socket_path" , help = "pass-through for tmux -S" )
19+ parser .add_argument ("-L" , "socket_name" , help = "pass-through for tmux -L" )
20+ parser .add_argument (
21+ "-c" ,
22+ "command" ,
23+ help = "Instead of opening shell, execute python code in libtmux and exit" ,
24+ )
25+ parser .add_argument (
26+ "--best" ,
27+ "shell" ,
28+ flag_value = "best" ,
29+ help = "Use best shell available in site packages" ,
30+ default = True ,
31+ )
32+ parser .add_argument ("--pdb" , "shell" , flag_value = "pdb" , help = "Use plain pdb" )
33+ parser .add_argument (
34+ "--code" , "shell" , flag_value = "code" , help = "Use stdlib's code.interact()"
35+ )
36+ parser .add_argument (
37+ "--ptipython" , "shell" , flag_value = "ptipython" , help = "Use ptpython + ipython"
38+ )
39+ parser .add_argument (
40+ "--ptpython" , "shell" , flag_value = "ptpython" , help = "Use ptpython"
41+ )
42+ parser .add_argument ("--ipython" , "shell" , flag_value = "ipython" , help = "Use ipython" )
43+ parser .add_argument ("--bpython" , "shell" , flag_value = "bpython" , help = "Use bpython" )
44+ parser .add_argument (
45+ "--use-pythonrc/--no-startup" ,
46+ "use_pythonrc" ,
47+ help = "Load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code" ,
48+ default = False ,
49+ )
50+ parser .add_argument (
51+ "--use-vi-mode/--no-vi-mode" ,
52+ "use_vi_mode" ,
53+ help = "Use vi-mode in ptpython/ptipython" ,
54+ default = False ,
55+ )
56+
57+
58+ # @click.command(name="shell")
59+ # @click.argument("session_name", nargs=1, required=False)
60+ # @click.argument("window_name", nargs=1, required=False)
61+ # @click.option("-S", "socket_path", help="pass-through for tmux -S")
62+ # @click.option("-L", "socket_name", help="pass-through for tmux -L")
63+ # @click.option(
64+ # "-c",
65+ # "command",
66+ # help="Instead of opening shell, execute python code in libtmux and exit",
67+ # )
68+ # @click.option(
69+ # "--best",
70+ # "shell",
71+ # flag_value="best",
72+ # help="Use best shell available in site packages",
73+ # default=True,
74+ # )
75+ # @click.option("--pdb", "shell", flag_value="pdb", help="Use plain pdb")
76+ # @click.option("--code", "shell", flag_value="code", help="Use stdlib's code.interact()")
77+ # @click.option(
78+ # "--ptipython", "shell", flag_value="ptipython", help="Use ptpython + ipython"
79+ # )
80+ # @click.option("--ptpython", "shell", flag_value="ptpython", help="Use ptpython")
81+ # @click.option("--ipython", "shell", flag_value="ipython", help="Use ipython")
82+ # @click.option("--bpython", "shell", flag_value="bpython", help="Use bpython")
83+ # @click.option(
84+ # "--use-pythonrc/--no-startup",
85+ # "use_pythonrc",
86+ # help="Load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code",
87+ # default=False,
88+ # )
89+ # @click.option(
90+ # "--use-vi-mode/--no-vi-mode",
91+ # "use_vi_mode",
92+ # help="Use vi-mode in ptpython/ptipython",
93+ # default=False,
94+ # )
95+
96+
4897def command_shell (
4998 session_name ,
5099 window_name ,
@@ -54,6 +103,7 @@ def command_shell(
54103 shell ,
55104 use_pythonrc ,
56105 use_vi_mode ,
106+ parser : t .Optional [argparse .ArgumentParser ] = None ,
57107):
58108 """Launch python shell for tmux server, session, window and pane.
59109
0 commit comments