Skip to content

Commit a944342

Browse files
author
Predeactor
committed
fix: resolve path when registering
1 parent e129247 commit a944342

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/ccl/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import pathlib
3-
from importlib.metadata import distribution as __dist
43
import typing
4+
from importlib.metadata import distribution as __dist
55

66
import click
77

@@ -17,7 +17,7 @@ def register_commands(
1717
group: click.Group,
1818
source: typing.Union[str, pathlib.Path],
1919
) -> None:
20-
path = pathlib.Path(source)
20+
path = pathlib.Path(source).resolve()
2121
_log.debug(f"Started registering commands in {path.resolve()}")
2222

2323
commands = fetch_commands_for_group(path)
@@ -31,7 +31,9 @@ def register_commands(
3131
group.add_command(command)
3232

3333

34-
def fetch_commands_for_group(source: pathlib.Path) -> typing.List[typing.Union[click.Command, click.Group]]:
34+
def fetch_commands_for_group(
35+
source: pathlib.Path,
36+
) -> typing.List[typing.Union[click.Command, click.Group]]:
3537
"""Return a list of click's commands or groups.
3638
3739
Parameters
@@ -53,7 +55,6 @@ def fetch_commands_for_group(source: pathlib.Path) -> typing.List[typing.Union[c
5355
entities.append(command)
5456

5557
if file.is_dir():
56-
5758
_log.debug(f"Found directory {file.resolve()}, looping inside...")
5859

5960
if (file / "__init__.py").exists():

src/ccl/finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import importlib.util
33
import logging
44
import pathlib
5+
import typing
56
from shutil import ExecError
67
from typing import Literal, overload
7-
import typing
88

99
import click
1010

0 commit comments

Comments
 (0)