Skip to content

Commit 1f05829

Browse files
committed
!squash almost finished
1 parent 7b05d30 commit 1f05829

File tree

7 files changed

+65
-40
lines changed

7 files changed

+65
-40
lines changed

tmuxp/cli/debug_info.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
import os
12
import pathlib
3+
import platform
4+
import sys
25

36
import click
47

8+
from libtmux import __version__ as libtmux_version
9+
from libtmux.common import get_version, tmux_cmd, which
10+
11+
from .. import __version__
12+
from .utils import tmuxp_echo
13+
514
tmuxp_path = pathlib.Path(__file__).parent.parent
615

716

tmuxp/cli/edit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import os
2+
import subprocess
3+
14
import click
25

3-
from .utils import ConfigPath
6+
from .utils import ConfigPath, scan_config
47

58

69
@click.command(name="edit", short_help="Run $EDITOR on config.")
@@ -9,4 +12,4 @@ def command_edit_config(config):
912
config = scan_config(config)
1013

1114
sys_editor = os.environ.get("EDITOR", "vim")
12-
call([sys_editor, config])
15+
subprocess.call([sys_editor, config])

tmuxp/cli/freeze.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
import os
2+
import sys
3+
14
import click
5+
import kaptan
26

37
from libtmux.server import Server
48

59
from .. import config, util
610
from ..workspacebuilder import freeze
11+
from . import exc
12+
from .utils import _validate_choices, get_abs_path, get_config_dir
713

814

915
@click.command(name="freeze")

tmuxp/cli/import_config.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,43 @@
88
from .utils import ConfigPath, _validate_choices, get_abs_path, tmuxp_echo
99

1010

11+
def get_tmuxinator_dir():
12+
"""
13+
Return tmuxinator configuration directory.
14+
15+
Checks for ``TMUXINATOR_CONFIG`` environmental variable.
16+
17+
Returns
18+
-------
19+
str :
20+
absolute path to tmuxinator config directory
21+
22+
See Also
23+
--------
24+
:meth:`tmuxp.config.import_tmuxinator`
25+
"""
26+
if "TMUXINATOR_CONFIG" in os.environ:
27+
return os.path.expanduser(os.environ["TMUXINATOR_CONFIG"])
28+
29+
return os.path.expanduser("~/.tmuxinator/")
30+
31+
32+
def get_teamocil_dir():
33+
"""
34+
Return teamocil configuration directory.
35+
36+
Returns
37+
-------
38+
str :
39+
absolute path to teamocil config directory
40+
41+
See Also
42+
--------
43+
:meth:`tmuxp.config.import_teamocil`
44+
"""
45+
return os.path.expanduser("~/.teamocil/")
46+
47+
1148
def _resolve_path_no_overwrite(config):
1249
path = get_abs_path(config)
1350
if os.path.exists(path):

tmuxp/cli/ls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import click
44

55
from .constants import VALID_CONFIG_DIR_FILE_EXTENSIONS
6-
from .utils import ConfigPath, _validate_choices, get_config_dir
6+
from .utils import get_config_dir
77

88

99
@click.command(name="ls", short_help=f"List configured sessions in {get_config_dir()}.")

tmuxp/cli/shell.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
import os
2+
13
import click
24

5+
from libtmux import Server
6+
7+
from .. import util
8+
from .._compat import PY3, PYMINOR
9+
310

411
@click.command(name="shell")
512
@click.argument("session_name", nargs=1, required=False)

tmuxp/cli/utils.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,6 @@ def get_config_dir():
5454
return path
5555

5656

57-
def get_tmuxinator_dir():
58-
"""
59-
Return tmuxinator configuration directory.
60-
61-
Checks for ``TMUXINATOR_CONFIG`` environmental variable.
62-
63-
Returns
64-
-------
65-
str :
66-
absolute path to tmuxinator config directory
67-
68-
See Also
69-
--------
70-
:meth:`tmuxp.config.import_tmuxinator`
71-
"""
72-
if "TMUXINATOR_CONFIG" in os.environ:
73-
return os.path.expanduser(os.environ["TMUXINATOR_CONFIG"])
74-
75-
return os.path.expanduser("~/.tmuxinator/")
76-
77-
78-
def get_teamocil_dir():
79-
"""
80-
Return teamocil configuration directory.
81-
82-
Returns
83-
-------
84-
str :
85-
absolute path to teamocil config directory
86-
87-
See Also
88-
--------
89-
:meth:`tmuxp.config.import_teamocil`
90-
"""
91-
return os.path.expanduser("~/.teamocil/")
92-
93-
9457
def _validate_choices(options):
9558
"""
9659
Callback wrapper for validating click.prompt input.

0 commit comments

Comments
 (0)