Skip to content

Commit

Permalink
fix: cli tool fixed to work
Browse files Browse the repository at this point in the history
  • Loading branch information
fevral13 committed Jan 5, 2024
1 parent 24ea56c commit af4acf4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions openapi_om/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
def main() -> int:
args_parser = _get_args_parser()
args = args_parser.parse_args()
args.func(args)
return exit(0)

try:
func = args.func
except AttributeError:
print(args_parser.print_help())
return exit(0)
else:
return func(args)


def _get_args_parser() -> argparse.ArgumentParser:
args_parser = argparse.ArgumentParser()
args_parser = argparse.ArgumentParser(argument_default="export")
subargs_parser = args_parser.add_subparsers(help="commands")

command_export = subargs_parser.add_parser("export")
Expand Down Expand Up @@ -52,7 +58,3 @@ def _command_export(args):
elif args.format == FORMAT_YAML:
yaml.dump(schema_dict, sys.stdout)
sys.stdout.flush()


if __name__ == "__main__":
main()

0 comments on commit af4acf4

Please sign in to comment.