fix: fix cli issue
This commit is contained in:
63
src/cli.py
63
src/cli.py
@@ -31,8 +31,8 @@ def parse_latex2xthesis_cli() -> LaTeX2XThesisCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2XThesisCli.input_file.__doc__,
|
||||
metavar="INPUT.",
|
||||
help="The path to input LaTeX file",
|
||||
metavar="INPUT.tex",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
@@ -41,7 +41,7 @@ def parse_latex2xthesis_cli() -> LaTeX2XThesisCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2XThesisCli.output_file.__doc__,
|
||||
help="The path to output XThesis file",
|
||||
metavar="OUTPUT.xml",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -51,7 +51,7 @@ def parse_latex2xthesis_cli() -> LaTeX2XThesisCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2XThesisCli.config_file.__doc__,
|
||||
help="The path to LaTeX2XThesis configuration file",
|
||||
metavar="CONFIG.toml",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -61,7 +61,7 @@ def parse_latex2xthesis_cli() -> LaTeX2XThesisCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2XThesisCli.resource_dir.__doc__,
|
||||
help="The path to resource directory for finding images and other resources referred in LaTeX file",
|
||||
metavar="RESOURCE_DIR",
|
||||
)
|
||||
|
||||
@@ -97,7 +97,7 @@ def parse_xthesis2docx_cli() -> XThesis2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=XThesis2DocxCli.input_file.__doc__,
|
||||
help="The path to input XThesis file",
|
||||
metavar="INPUT.xml",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -107,7 +107,7 @@ def parse_xthesis2docx_cli() -> XThesis2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=XThesis2DocxCli.output_file.__doc__,
|
||||
help="The path to output Docx file",
|
||||
metavar="OUTPUT.docx",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -117,7 +117,7 @@ def parse_xthesis2docx_cli() -> XThesis2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=XThesis2DocxCli.config_file.__doc__,
|
||||
help="The path to XThesis2Docx configuration file",
|
||||
metavar="CONFIG.toml",
|
||||
)
|
||||
|
||||
@@ -133,8 +133,10 @@ class LaTeX2DocxCli:
|
||||
"""The path to input LaTeX file"""
|
||||
output_file: Path
|
||||
"""The path to output Docx file"""
|
||||
config_file: Path
|
||||
"""The path to LaTeX2Docx configuration file"""
|
||||
frontend_config_file: Path
|
||||
"""The path to LaTeX2XThesis configuration file"""
|
||||
backend_config_file: Path
|
||||
"""The path to XThesis2Docx configuration file"""
|
||||
resource_dir: Path
|
||||
"""The path to resource directory for finding images and other resources referred in LaTeX file"""
|
||||
|
||||
@@ -149,9 +151,14 @@ class LaTeX2DocxCli:
|
||||
"""
|
||||
return (
|
||||
LaTeX2XThesisCli(
|
||||
self.input_file, intermediate_file, self.config_file, self.resource_dir
|
||||
self.input_file,
|
||||
intermediate_file,
|
||||
self.frontend_config_file,
|
||||
self.resource_dir,
|
||||
),
|
||||
XThesis2DocxCli(
|
||||
intermediate_file, self.output_file, self.backend_config_file
|
||||
),
|
||||
XThesis2DocxCli(intermediate_file, self.output_file, self.config_file),
|
||||
)
|
||||
|
||||
|
||||
@@ -168,7 +175,7 @@ def parse_latex2docx_cli() -> LaTeX2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2DocxCli.input_file.__doc__,
|
||||
help="The path to input LaTeX file",
|
||||
metavar="INPUT.tex",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -178,18 +185,28 @@ def parse_latex2docx_cli() -> LaTeX2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2DocxCli.output_file.__doc__,
|
||||
help="The path to output Docx file",
|
||||
metavar="OUTPUT.docx",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c",
|
||||
"--config",
|
||||
dest="config_file",
|
||||
"-f",
|
||||
"--frontend-config",
|
||||
dest="frontend_config_file",
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2DocxCli.config_file.__doc__,
|
||||
metavar="CONFIG.toml",
|
||||
help="The path to LaTeX2XThesis configuration file",
|
||||
metavar="FRONTEND-CONFIG.toml",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-b",
|
||||
"--backend-config",
|
||||
dest="backend_config_file",
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="The path to XThesis2Docx configuration file",
|
||||
metavar="BACKEND-CONFIG.toml",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r",
|
||||
@@ -198,11 +215,15 @@ def parse_latex2docx_cli() -> LaTeX2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help=LaTeX2DocxCli.resource_dir.__doc__,
|
||||
help="The path to resource directory for finding images and other resources referred in LaTeX file",
|
||||
metavar="RESOURCE_DIR",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
return LaTeX2DocxCli(
|
||||
args.input_file, args.output_file, args.config_file, args.resource_dir
|
||||
args.input_file,
|
||||
args.output_file,
|
||||
args.frontend_config_file,
|
||||
args.backend_config_file,
|
||||
args.resource_dir,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user