Skip to content

Commit

Permalink
Remove unused arguments to dotm()
Browse files Browse the repository at this point in the history
  • Loading branch information
winpat committed Feb 17, 2025
1 parent 7523326 commit a0145ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions dotm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def get_relevant_files(config: dict) -> list[Dotfile]:
return relevant


def dotm(
config: dict, source_dir: Path, target_dir: Path
) -> tuple[list[Dotfile], list[Dotfile]]:
def dotm(config: dict) -> tuple[list[Dotfile], list[Dotfile]]:
"""Link relevant dotfiles according to .dotrc configuration."""

try:
Expand Down Expand Up @@ -62,14 +60,8 @@ def dotm(


def main():
working_dir = Path.cwd()
home_dir = Path.home()

dotm(
config=load_config(working_dir, home_dir),
source_dir=working_dir,
target_dir=home_dir,
)
cfg = load_config(source_dir=Path.home(), target_dir=Path.cwd())
dotm(cfg)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions dotm/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_no_relevant_files(source_dir, target_dir, capsys, mocker):
mocker.patch("dotm.main.gethostname", return_value="host")

with pytest.raises(SystemExit) as excinfo:
dotm({}, source_dir, target_dir)
dotm({})

stderr = capsys.readouterr().out
assert 'No files matching host "host"' in stderr
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_dotm(mocker, source_dir, target_dir):
touch_dotrc(source_dir, cfg)

mocker.patch("dotm.main.gethostname", return_value="host1")
existing, created = dotm(cfg, source_dir, target_dir)
existing, created = dotm(cfg)

assert [df.name for df in created] == [".emacs", ".bashrc"]
assert existing == []

0 comments on commit a0145ba

Please sign in to comment.