Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions strictdoc/cli/cli_arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,6 @@ def is_debug_mode(self) -> bool:
def is_about_command(self) -> bool:
return str(self.args.command) == "about"

@property
def is_passthrough_command(self) -> bool:
return str(self.args.command) == "passthrough"

@property
def is_export_command(self) -> bool:
return str(self.args.command) == "export"
Expand Down
95 changes: 0 additions & 95 deletions strictdoc/cli/command_parser_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def build(self) -> SDocArgumentParser:
self.add_manage_command(command_subparsers)
self.add_import_command(command_subparsers)
self.add_version_command(command_subparsers)
self.add_passthrough_command(command_subparsers)
self.add_dump_command(command_subparsers)
self.add_diff_command(command_subparsers)

Expand Down Expand Up @@ -404,100 +403,6 @@ def add_version_command(
formatter_class=formatter,
)

@staticmethod
def add_passthrough_command(
parent_command_parser: "argparse._SubParsersAction[SDocArgumentParser]",
) -> None:
# Passthrough command is kept for backwards compatibility. It will
# internally be handled as export --formats sdoc.
command_parser_passthrough = parent_command_parser.add_parser(
"passthrough",
help="Read an SDoc file, then output it again. Deprecated, use "
"strictdoc export --formats sdoc instead.",
formatter_class=formatter,
)
command_parser_passthrough.add_argument(
"input_paths",
type=str,
nargs="+",
help="One or more folders with *.sdoc files",
)
command_parser_passthrough.add_argument(
"--output-dir",
type=str,
help="A directory where to output the SDoc files to.",
)
# FIXME: --filter-requirements will be removed in 2026.
command_parser_passthrough.add_argument(
"--filter-nodes",
"--filter-requirements",
dest="filter_nodes",
type=str,
help="Filter which requirements will be exported.",
)
command_parser_passthrough.add_argument(
"--view",
type=str,
help="Choose which view will be exported.",
)

# Hidden default values to make deprecated passthrough parser compatible
# with SDocArgsParser.get_export_config.
command_parser_passthrough.add_argument(
"--project-title", const=None, help=argparse.SUPPRESS
)
command_parser_passthrough.add_argument(
"--formats",
default=["sdoc"],
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--fields",
default=None,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--generate-bundle-document",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--no-parallelization",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--enable-mathjax",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--included-documents",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--reqif-profile",
default=None,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--reqif-multiline-is-xhtml",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--reqif-enable-mid",
default=False,
help=argparse.SUPPRESS,
)
command_parser_passthrough.add_argument(
"--chromedriver",
default=None,
help=argparse.SUPPRESS,
)
add_config_argument(command_parser_passthrough)

@staticmethod
def add_dump_command(
parent_command_parser: "argparse._SubParsersAction[SDocArgumentParser]",
Expand Down
7 changes: 1 addition & 6 deletions strictdoc/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ def _main(parallelizer: Parallelizer, parser: SDocArgsParser) -> None:

project_config: ProjectConfig

if parser.is_passthrough_command or parser.is_export_command:
if parser.is_passthrough_command:
print( # noqa: T201
"warning: passthrough is deprecated, use strictdoc "
"export --formats sdoc instead."
)
if parser.is_export_command:
export_config: ExportCommandConfig = parser.get_export_config()
try:
export_config.validate()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %strictdoc passthrough %S --view PRINT_VIEW --output-dir %T
RUN: %strictdoc export %S --formats=sdoc --view PRINT_VIEW --output-dir %T
RUN: %cat %T/sdoc/input.sdoc | filecheck %s --check-prefix CHECK-SDOC

CHECK-SDOC: REQ-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %strictdoc passthrough %S --output-dir %T
RUN: %strictdoc export %S --formats=sdoc --output-dir %T
RUN: %cat %T/sdoc/input.sdoc | filecheck %s --check-prefix=CHECK-SDOC

CHECK-SDOC: REQ-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %expect_exit 1 %strictdoc passthrough %S/input.sdoc --output-dir %T/ | filecheck %s
RUN: %expect_exit 1 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir %T/ | filecheck %s

# The same validation message should be produced even if the auto-uid command is executed.
# https://github.com/strictdoc-project/strictdoc/issues/1896
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %expect_exit 1 %strictdoc passthrough %S/input.sdoc --output-dir %T/ | filecheck %s
RUN: %expect_exit 1 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir %T/ | filecheck %s

CHECK: error: could not parse file: {{.*}}/input.sdoc.
CHECK: Semantic error: Node is missing a field that is required by grammar: UID.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RUN: %expect_exit 0 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir=%T/
RUN: %diff %S/input.sdoc %T/sdoc/input.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RUN: %expect_exit 0 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir=%T/
RUN: %diff %S/input.sdoc %T/sdoc/input.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RUN: %expect_exit 0 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir=%T/
RUN: %diff %S/input.sdoc %T/sdoc/input.sdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RUN: %expect_exit 0 %strictdoc passthrough %S/input --output-dir=%T
RUN: %expect_exit 0 %strictdoc export %S/input --formats=sdoc --output-dir=%T
RUN: %diff %S/input/input1.sdoc %T/sdoc/input1.sdoc
RUN: %diff %S/input/nested/input2.sdoc %T/sdoc/nested/input2.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RUN: %expect_exit 0 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir=%T --filter-requirements '("2" in node["TITLE"] or "4" in node["TITLE"])' | filecheck %s --dump-input=fail
CHECK: Reading SDOC: input.sdoc

RUN: %diff %S/expected/output.sdoc %T/sdoc/input.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RUN: mkdir %T/sandbox
RUN: cp %S/input.sdoc %T/sandbox/
RUN: %expect_exit 0 %strictdoc export %T/sandbox/input.sdoc --formats=sdoc --output-dir=%T/sandbox --filter-requirements='"2" not in node["TITLE"]'
RUN: %diff %S/expected.sdoc %T/sandbox/sdoc/input.sdoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %expect_exit 0 %strictdoc passthrough %S/input.sdoc --output-dir=%T | filecheck %s --dump-input=fail
RUN: %expect_exit 0 %strictdoc export %S/input.sdoc --formats=sdoc --output-dir=%T | filecheck %s --dump-input=fail
CHECK: Reading SDOC: input.sdoc

RUN: %cat %T/sdoc/input.sdoc | filecheck %s --dump-input=fail --check-prefix=CHECK-OUT-SDOC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: %expect_exit 0 %strictdoc passthrough %S/ --output-dir=%T/
RUN: %expect_exit 0 %strictdoc export %S/ --formats=sdoc --output-dir=%T/

RUN: %diff %S/input.sdoc %T/sdoc/input.sdoc
RUN: %diff %S/nested/input2.sdoc %T/sdoc/nested/input2.sdoc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUN: cd "%strictdoc_root/" && %strictdoc passthrough "%strictdoc_root/" --output-dir="%T/"
RUN: cd "%strictdoc_root/" && %strictdoc export "%strictdoc_root/" --formats=sdoc --output-dir="%T/"

RUN: %diff "%strictdoc_root/docs/strictdoc_01_user_guide.sdoc" "%T/sdoc/docs/strictdoc_01_user_guide.sdoc"
RUN: %diff "%strictdoc_root/docs/strictdoc_02_feature_map.sdoc" "%T/sdoc/docs/strictdoc_02_feature_map.sdoc"
Expand Down
56 changes: 0 additions & 56 deletions tests/unit/strictdoc/cli/test_cli_arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,59 +155,3 @@ def test_export_09_config():
config_parser = create_sdoc_args_parser(args)
export_config = config_parser.get_export_config()
assert export_config.get_path_to_config() == "/path/to/strictdoc.toml"


def test_passthrough_01_minimal():
parser = cli_args_parser()

args = parser.parse_args(["passthrough", "input.sdoc"])

assert sorted(args._get_kwargs()) == [
("chromedriver", None),
("command", "passthrough"),
("config", None),
("debug", False),
("enable_mathjax", False),
("fields", None),
("filter_nodes", None),
("formats", ["sdoc"]),
("generate_bundle_document", False),
("included_documents", False),
("input_paths", ["input.sdoc"]),
("no_parallelization", False),
("output_dir", None),
("project_title", None),
("reqif_enable_mid", False),
("reqif_multiline_is_xhtml", False),
("reqif_profile", None),
("view", None),
]


def test_passthrough_02_minimal():
parser = cli_args_parser()

args = parser.parse_args(
["passthrough", "input.sdoc", "--output-dir", "SANDBOX/"]
)

assert sorted(args._get_kwargs()) == [
("chromedriver", None),
("command", "passthrough"),
("config", None),
("debug", False),
("enable_mathjax", False),
("fields", None),
("filter_nodes", None),
("formats", ["sdoc"]),
("generate_bundle_document", False),
("included_documents", False),
("input_paths", ["input.sdoc"]),
("no_parallelization", False),
("output_dir", "SANDBOX/"),
("project_title", None),
("reqif_enable_mid", False),
("reqif_multiline_is_xhtml", False),
("reqif_profile", None),
("view", None),
]
Loading