Skip to content

Commit 8bdef74

Browse files
committed
refactor!: get_config_dir() -> get_workspace_dir()
1 parent a57b84e commit 8bdef74

File tree

9 files changed

+20
-18
lines changed

9 files changed

+20
-18
lines changed

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from libtmux.test import namer
1717
from tests.fixtures import utils as test_utils
18-
from tmuxp.cli.utils import get_config_dir
18+
from tmuxp.cli.utils import get_workspace_dir
1919

2020
if t.TYPE_CHECKING:
2121
from libtmux.session import Session
@@ -56,7 +56,7 @@ def tmuxp_configdir_default(
5656
monkeypatch: pytest.MonkeyPatch, tmuxp_configdir: pathlib.Path
5757
) -> None:
5858
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmuxp_configdir))
59-
assert get_config_dir() == str(tmuxp_configdir)
59+
assert get_workspace_dir() == str(tmuxp_configdir)
6060

6161

6262
@pytest.fixture(scope="function")

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ If you need an internal API stabilized please [file an issue](https://github.com
4646
## CLI
4747

4848
```{eval-rst}
49-
.. automethod:: tmuxp.cli.utils.get_config_dir
49+
.. automethod:: tmuxp.cli.utils.get_workspace_dir
5050
```
5151

5252
```{eval-rst}

src/tmuxp/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def startup(config_dir: pathlib.Path) -> None:
184184
185185
Parameters
186186
----------
187-
str : get_config_dir(): Config directory to search
187+
str : get_workspace_dir(): Config directory to search
188188
"""
189189

190190
if not os.path.exists(config_dir):

src/tmuxp/cli/convert.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from tmuxp.config_reader import ConfigReader
77

8-
from .utils import find_workspace_file, get_config_dir, prompt_yes_no
8+
from .utils import find_workspace_file, get_workspace_dir, prompt_yes_no
99

1010

1111
def create_convert_subparser(
@@ -40,7 +40,9 @@ def command_convert(
4040
parser: t.Optional[argparse.ArgumentParser] = None,
4141
) -> None:
4242
"""Convert a tmuxp config between JSON and YAML."""
43-
workspace_file = find_workspace_file(workspace_file, workspace_dir=get_config_dir())
43+
workspace_file = find_workspace_file(
44+
workspace_file, workspace_dir=get_workspace_dir()
45+
)
4446

4547
if isinstance(workspace_file, str):
4648
workspace_file = pathlib.Path(workspace_file)

src/tmuxp/cli/freeze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from .. import util
1212
from ..workspace import freezer
13-
from .utils import get_config_dir, prompt, prompt_choices, prompt_yes_no
13+
from .utils import get_workspace_dir, prompt, prompt_choices, prompt_yes_no
1414

1515
if t.TYPE_CHECKING:
1616
from typing_extensions import Literal, TypeAlias, TypeGuard
@@ -137,7 +137,7 @@ def command_freeze(
137137
while not dest:
138138
save_to = os.path.abspath(
139139
os.path.join(
140-
get_config_dir(),
140+
get_workspace_dir(),
141141
"{}.{}".format(
142142
sconf.get("session_name"), args.workspace_format or "yaml"
143143
),

src/tmuxp/cli/load.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from ..workspace.builder import WorkspaceBuilder
2424
from .utils import (
2525
find_workspace_file,
26-
get_config_dir,
26+
get_workspace_dir,
2727
prompt_choices,
2828
prompt_yes_no,
2929
style,
@@ -471,7 +471,7 @@ def load_workspace(
471471

472472

473473
def workspace_file_completion(ctx, params, incomplete):
474-
config_dir = pathlib.Path(get_config_dir())
474+
config_dir = pathlib.Path(get_workspace_dir())
475475
choices: t.List[pathlib.Path] = []
476476

477477
# CWD Paths
@@ -644,7 +644,7 @@ def command_load(
644644

645645
for idx, workspace_file in enumerate(args.workspace_files):
646646
workspace_file = find_workspace_file(
647-
workspace_file, workspace_dir=get_config_dir()
647+
workspace_file, workspace_dir=get_workspace_dir()
648648
)
649649

650650
detached = original_detached_option

src/tmuxp/cli/ls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import typing as t
44

55
from .constants import VALID_WORKSPACE_DIR_FILE_EXTENSIONS
6-
from .utils import get_config_dir
6+
from .utils import get_workspace_dir
77

88

99
def create_ls_subparser(
@@ -15,7 +15,7 @@ def create_ls_subparser(
1515
def command_ls(
1616
parser: t.Optional[argparse.ArgumentParser] = None,
1717
) -> None:
18-
tmuxp_dir = get_config_dir()
18+
tmuxp_dir = get_workspace_dir()
1919
if os.path.exists(tmuxp_dir) and os.path.isdir(tmuxp_dir):
2020
for f in sorted(os.listdir(tmuxp_dir)):
2121
stem, ext = os.path.splitext(f)

src/tmuxp/cli/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def tmuxp_echo(
3232
print(message)
3333

3434

35-
def get_config_dir() -> str:
35+
def get_workspace_dir() -> str:
3636
"""
3737
Return tmuxp configuration directory.
3838
@@ -93,7 +93,7 @@ def find_workspace_file(
9393
- a period, .
9494
"""
9595
if not workspace_dir:
96-
workspace_dir = get_config_dir()
96+
workspace_dir = get_workspace_dir()
9797
path = os.path
9898
exists, join, isabs = path.exists, path.join, path.isabs
9999
dirname, normpath, splitext = path.dirname, path.normpath, path.splitext

tests/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
from tmuxp.cli.utils import (
2727
find_workspace_file,
28-
get_config_dir,
28+
get_workspace_dir,
2929
is_pure_name,
3030
tmuxp_echo,
3131
)
@@ -157,7 +157,7 @@ def test_tmuxp_configdir_env_var(
157157
) -> None:
158158
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmp_path))
159159

160-
assert get_config_dir() == str(tmp_path)
160+
assert get_workspace_dir() == str(tmp_path)
161161

162162

163163
def test_tmuxp_configdir_xdg_config_dir(
@@ -167,7 +167,7 @@ def test_tmuxp_configdir_xdg_config_dir(
167167
tmux_dir = tmp_path / "tmuxp"
168168
tmux_dir.mkdir()
169169

170-
assert get_config_dir() == str(tmux_dir)
170+
assert get_workspace_dir() == str(tmux_dir)
171171

172172

173173
def test_resolve_dot(

0 commit comments

Comments
 (0)