Skip to content

Commit 646fcb1

Browse files
committed
[export][latex] Rename --languages flag to --lang
1 parent 166b274 commit 646fcb1

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

bin/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
grep -Ev '^(h|jobs|time|verbose)$' | sed "s/^/'/;s/$/',/" | tr '\n' ' ' | sed 's/^/ARGS_LIST: Final[Sequence[str]] = [/;s/, $/]\n/'
120120
"""
121121
# fmt: off
122-
ARGS_LIST: Final[Sequence[str]] = ['1', 'add', 'all', 'answer', 'api', 'author', 'check_deterministic', 'clean', 'colors', 'contest', 'contest_id', 'contestname', 'cp', 'default_solution', 'depth', 'directory', 'error', 'force', 'force_build', 'generic', 'input', 'interaction', 'interactive', 'invalid', 'kattis', 'languages', 'legacy', 'memory', 'more', 'move_to', 'no_bar', 'no_generate', 'no_solution', 'no_solutions', 'no_testcase_sanity_checks', 'no_time_limit', 'no_validators', 'no_visualizer', 'open', 'order', 'order_from_ccs', 'overview', 'password', 'post_freeze', 'problem', 'problemname', 'remove', 'reorder', 'samples', 'sanitizer', 'skel', 'skip', 'sort', 'submissions', 'table', 'testcases', 'time_limit', 'timeout', 'token', 'tree', 'type', 'username', 'valid_output', 'watch', 'web', 'write']
122+
ARGS_LIST: Final[Sequence[str]] = ['1', 'add', 'all', 'answer', 'api', 'author', 'check_deterministic', 'clean', 'colors', 'contest', 'contest_id', 'contestname', 'cp', 'default_solution', 'depth', 'directory', 'error', 'force', 'force_build', 'generic', 'input', 'interaction', 'interactive', 'invalid', 'kattis', 'lang', 'legacy', 'memory', 'more', 'move_to', 'no_bar', 'no_generate', 'no_solution', 'no_solutions', 'no_testcase_sanity_checks', 'no_time_limit', 'no_validators', 'no_visualizer', 'open', 'order', 'order_from_ccs', 'overview', 'password', 'post_freeze', 'problem', 'problemname', 'remove', 'reorder', 'samples', 'sanitizer', 'skel', 'skip', 'sort', 'submissions', 'table', 'testcases', 'time_limit', 'timeout', 'token', 'tree', 'type', 'username', 'valid_output', 'watch', 'web', 'write']
123123
# fmt: on
124124

125125

bin/export.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515

1616
def select_languages(problems: list[Problem]) -> list[str]:
17-
if config.args.languages:
18-
languages = config.args.languages
17+
if config.args.lang:
18+
languages = config.args.lang
1919
else:
2020
languages = list(set(sum((p.statement_languages for p in problems), [])))
2121
languages.sort()
2222
if config.args.legacy:
2323
if len(languages) > 1:
2424
# legacy can handle at most one language
25-
fatal("Multiple languages found, please specify one with --languages")
25+
fatal("Multiple languages found, please specify one with --lang")
2626
if not languages:
2727
fatal("No language found")
2828
return languages

bin/latex.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,21 +396,21 @@ def build_problem_pdf(problem: "Problem", language: str, build_type=PdfType.PROB
396396

397397
def build_problem_pdfs(problem: "Problem", build_type=PdfType.PROBLEM, web=False):
398398
"""Build PDFs for various languages. If list of languages is specified,
399-
(either via config files or --language arguments), build those. Otherwise
399+
(either via config files or --lang arguments), build those. Otherwise
400400
build all languages for which there is a statement latex source.
401401
"""
402-
if config.args.languages is not None:
403-
for lang in config.args.languages:
402+
if config.args.lang is not None:
403+
for lang in config.args.lang:
404404
if lang not in problem.statement_languages:
405405
message(
406406
f"No statement source for language {lang}",
407407
problem.name,
408408
color_type=MessageType.FATAL,
409409
)
410-
languages = config.args.languages
410+
languages = config.args.lang
411411
else:
412412
languages = problem.statement_languages
413-
# For solutions or problem slides, filter for `<build_type>.<language>.tex` files that exist.
413+
# For solutions or problem slides, filter for `<build_type>.<lang>.tex` files that exist.
414414
if build_type != PdfType.PROBLEM:
415415
filtered_languages = []
416416
for lang in languages:
@@ -424,7 +424,7 @@ def build_problem_pdfs(problem: "Problem", build_type=PdfType.PROBLEM, web=False
424424
)
425425
languages = filtered_languages
426426
if config.args.watch and len(languages) > 1:
427-
fatal("--watch does not work with multiple languages. Please use --language")
427+
fatal("--watch does not work with multiple languages. Please use --lang")
428428
return all([build_problem_pdf(problem, lang, build_type, web) for lang in languages])
429429

430430

@@ -551,8 +551,8 @@ def build_contest_pdfs(contest, problems, tmpdir, lang=None, build_type=PdfType.
551551
message(
552552
"No statement language present in every problem.", contest, color_type=MessageType.FATAL
553553
)
554-
if config.args.languages is not None:
555-
languages = config.args.languages
554+
if config.args.lang is not None:
555+
languages = config.args.lang
556556
for lang in set(languages) - statement_languages:
557557
message(
558558
f"Unable to build all statements for language {lang}",
@@ -563,7 +563,7 @@ def build_contest_pdfs(contest, problems, tmpdir, lang=None, build_type=PdfType.
563563
languages = statement_languages
564564
if config.args.watch and len(languages) > 1:
565565
message(
566-
"--watch does not work with multiple languages. Please use --language",
566+
"--watch does not work with multiple languages. Please use --lang",
567567
contest,
568568
color_type=MessageType.FATAL,
569569
)

bin/skel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def new_problem():
139139
if config.args.problem:
140140
fatal("--problem does not work for new_problem.")
141141

142-
statement_languages = config.args.languages if config.args.languages else ["en"]
142+
statement_languages = config.args.lang if config.args.lang else ["en"]
143143
main_language = "en" if "en" in statement_languages else statement_languages[0]
144144

145145
problemname = {

bin/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def build_parser():
343343
action="store_true",
344344
help="Copy the output pdf instead of symlinking it.",
345345
)
346-
global_parser.add_argument("--languages", nargs="+", help="Languages to include.")
346+
global_parser.add_argument("--lang", nargs="+", help="Languages to include.")
347347

348348
subparsers = parser.add_subparsers(
349349
title="actions", dest="action", parser_class=SuppressingParser

doc/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The flags below work for any subcommand:
5555
- `--no-bar`: Disable showing progress bars. This is useful when running in non-interactive contexts (such as CI jobs) or on platforms/terminals that don't handle the progress bars well.
5656
- `--error`/`-e`: show full output of failing commands using `--error`. The default is to show a short snippet only.
5757
- `--force-build`: Force rebuilding binaries instead of reusing cached version.
58-
- `--languages`: select languages to use for LaTeX commands. The languages should be specified by language codes like `en` or `nl`.
58+
- `--lang`: select languages to use for LaTeX commands. The languages should be specified by language codes like `en` or `nl`.
5959

6060
# Problem development
6161

doc/multiple_languages.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ Here, `LANG` is a two-letter language code, see
1515

1616
It is expected that the languages keys in the metadata and statement files agree.
1717

18-
The default language for BAPCtools is English, but multiple languages can be specified at various points of the tool, typically using the `--languages` flag or configuration files.
18+
The default language for BAPCtools is English, but multiple languages can be specified at various points of the tool, typically using the `--lang` flag or configuration files.
1919

2020
## Creating a contest
2121

2222
In short,
2323

24-
1. configure `languages` in `.bapctools.yaml`.
24+
1. configure `lang` in `.bapctools.yaml`.
2525
2. add a skeleton for `problem.LANG.tex` in `skel/problem/statement`.
2626

27-
### Configure `languages`
27+
### Configure `lang`
2828

29-
To create a contest supporting French, Dutch, and Luxembourgish, set the configurartion key `languages` to the list `['nl', 'fr', 'lt']`.
29+
To create a contest supporting French, Dutch, and Luxembourgish, set the configurartion key `lang` to the list `['nl', 'fr', 'lt']`.
3030
Configuration keys can be set in many ways, see **Personal configuration file** in the BAPCtools documentation, but an easy way is to create a new contest:
3131

3232
```sh
@@ -36,7 +36,7 @@ bt new_contest
3636
and then create or extend the file `<contestdirectory>/.bapctools.yaml` with
3737

3838
```yaml
39-
languages:
39+
lang:
4040
- nl
4141
- fr
4242
- lt
@@ -82,13 +82,13 @@ To create a problem,
8282
bt new_problem
8383
```
8484

85-
will look for the `languages` configuration (for instance, at contest level) and use that by default.
85+
will look for the `lang` configuration (for instance, at contest level) and use that by default.
8686
Thus, if the contest is set up as above, you need to do nothing extra.
8787

8888
With arguments, or outside of a contest directory,
8989

9090
```sh
91-
bt new_problem --languages en fr
91+
bt new_problem --lang en fr
9292
```
9393

9494
creates a problem with two languages, English and French.
@@ -108,7 +108,7 @@ creates PDFs for every problem language statement `problem.xy.tex`.
108108
With arguments,
109109

110110
```sh
111-
bt pdf --languages en fr
111+
bt pdf --lang en fr
112112
```
113113

114114
produces PDFs for English and French.
@@ -117,7 +117,7 @@ The resulting PDFs are named `<problemdirectory>/problem.xy.pdf`.
117117

118118
## Solution PDF
119119

120-
Similarly, `bt solutions [--languages en fr]` creates
120+
Similarly, `bt solutions [--lang en fr]` creates
121121
`<problemdirectory>/solution.xy.pdf` for the given languages, defaulting to
122122
all available `solution.xy.tex` files.
123123

0 commit comments

Comments
 (0)