diff options
author | Piotr Miller <nwg.piotr@gmail.com> | 2024-04-21 01:32:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 01:32:48 +0200 |
commit | bf94d97e51bc0fc136c831d5fc4b521b9523470d (patch) | |
tree | df2e60ead0f837dc470d69dd0b88f6caff616f42 | |
parent | d91f184921898a8848de6b07fa8e057b52120d11 (diff) | |
parent | 9f7d5c60270ba7ef0023bdb8c8ae324db43db77c (diff) | |
download | autotiling-bf94d97e51bc0fc136c831d5fc4b521b9523470d.tar.gz |
Merge pull request #54 from josch/argparse-manpage
Split out argparse.ArgumentParser into its own function
-rw-r--r-- | autotiling/main.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/autotiling/main.py b/autotiling/main.py index 9096617..4ccfe59 100644 --- a/autotiling/main.py +++ b/autotiling/main.py @@ -127,8 +127,8 @@ def switch_splitting(i3, e, debug, outputs, workspaces, depth_limit, splitwidth, print(f"Error: {e}", file=sys.stderr) -def main(): - parser = argparse.ArgumentParser() +def get_parser(): + parser = argparse.ArgumentParser(prog="autotiling", description="Script for sway and i3 to automatically switch the horizontal / vertical window split orientation") parser.add_argument("-d", "--debug", action="store_true", help="print debug messages to stderr") @@ -166,7 +166,10 @@ def main(): parser.add_argument("-e", "--events", nargs="*", type=str, default=["WINDOW", "MODE"], help="list of events to trigger switching split orientation; default: WINDOW MODE") - args = parser.parse_args() + return parser + +def main(): + args = get_parser().parse_args() if args.debug: if args.outputs: |