Skip to content

Commit

Permalink
Merge pull request #54 from josch/argparse-manpage
Browse files Browse the repository at this point in the history
Split out argparse.ArgumentParser into its own function
  • Loading branch information
nwg-piotr authored Apr 20, 2024
2 parents d91f184 + 9f7d5c6 commit bf94d97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions autotiling/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit bf94d97

Please sign in to comment.