Skip to content

Commit

Permalink
[heroku] refs #25 - Create a subparser for running the app in heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
e1Ru1o committed Nov 6, 2020
1 parent f65abaa commit cb05f6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ def main(args):
else:
raise Exception(f'Invalid or missing "token" in {args.config}')

def heroku(args): pass

if __name__ == '__main__':
import argparse

parser = argparse.ArgumentParser(description='Bot initializer')
parser.set_defaults(command=main)

parser.add_argument('-c', '--config', type=str, default='config.ini', help='path of the configuration file')
parser.add_argument('--debug', help='execute in debug mode', action="store_true")

subparsers = parser.add_subparsers()
heroku_parser = subparsers.add_parser('heroku', help="Run a bot instance using heroku")
heroku_parser.set_defaults(command=heroku)

args = parser.parse_args()
main(args)
args.command(args)

0 comments on commit cb05f6b

Please sign in to comment.