Skip to content

Commit 3bfba95

Browse files
authored
Merge pull request #30 from openSUSE/refactor-cmd-to-packages
Refactor: make commands a package
2 parents 1240512 + 976ec7c commit 3bfba95

12 files changed

Lines changed: 102 additions & 107 deletions

File tree

changelog.d/30.refactor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Refactor subcommands into packages
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
import click
3838

39-
from ..models.doctype import Doctype
40-
from .callback import validate_doctypes
41-
from .context import DocBuildContext
39+
from ...models.doctype import Doctype
40+
from ..callback import validate_doctypes
41+
from ..context import DocBuildContext
4242

4343

4444
@click.command(
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import click
44

5-
from .context import DocBuildContext
6-
75

86
@click.command(help=__doc__)
97
@click.pass_context
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
import click
99

10-
from ..config.app import replace_placeholders
11-
from .context import DocBuildContext
12-
from .process_validation import process
10+
from ..context import DocBuildContext
11+
from . import process as process_mod
1312

1413
log = logging.getLogger(__name__)
1514

@@ -47,6 +46,6 @@ def validate(ctx: click.Context, xmlfiles: tuple | Iterator[Path]) -> None:
4746

4847
log.info('Validating XML configuration files')
4948

50-
result = asyncio.run(process(context, xmlfiles=xml_files_to_process))
49+
result = asyncio.run(process_mod.process(context, xmlfiles=xml_files_to_process))
5150

5251
ctx.exit(result) # Use the result as the exit code for the CLI
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
from lxml import etree
1010
from rich.console import Console
1111

12-
from ..cli.context import DocBuildContext
13-
from ..config.xml.checks import CheckResult, register_check
14-
from ..config.xml.stitch import create_stitchfile
15-
from ..constants import XMLDATADIR
16-
from ..utils.decorators import RegistryDecorator
17-
from ..utils.paths import calc_max_len
12+
from ...config.xml.checks import CheckResult, register_check
13+
from ...config.xml.stitch import create_stitchfile
14+
from ...constants import XMLDATADIR
15+
from ...utils.decorators import RegistryDecorator
16+
from ...utils.paths import calc_max_len
17+
from ..context import DocBuildContext
1818

1919
# Cast to help with type checking
2020
registry: RegistryDecorator = register_check # type: ignore[assignment]

tests/cli/c14n/__init__.py

Whitespace-only changes.

tests/cli/validate/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)