mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-05 20:38:04 +02:00
scanner: rework the main() function into something easier to test
Rename to scanner() and take an argument vector that can be passed to ArgumentParser.parse_args(). This makes testing the scanner's CLI a lot easier.
This commit is contained in:
parent
091948e9ef
commit
3a9eb2d8b6
1 changed files with 3 additions and 3 deletions
|
|
@ -832,7 +832,7 @@ def generate_source(
|
|||
return jtemplate.stream(data)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
def scanner(argv: list[str]) -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=dedent(
|
||||
"""
|
||||
|
|
@ -894,7 +894,7 @@ def main() -> None:
|
|||
"template", type=str, help="The Jinja2 compatible template file"
|
||||
)
|
||||
|
||||
ns = parser.parse_args()
|
||||
ns = parser.parse_args(argv)
|
||||
assert ns.protocol.exists()
|
||||
|
||||
try:
|
||||
|
|
@ -941,4 +941,4 @@ def main() -> None:
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
scanner(sys.argv[1:])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue