mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
first step
This commit is contained in:
+12
-11
@@ -1,14 +1,15 @@
|
|||||||
from argenta.app import App
|
import argparse
|
||||||
from argenta.command import Command
|
|
||||||
from argenta.router import Router
|
|
||||||
|
|
||||||
router = Router()
|
|
||||||
|
|
||||||
@router.command(Command('test'))
|
parser = argparse.ArgumentParser(prog='ProgramName',
|
||||||
def test():
|
description='What the program does',
|
||||||
print('test command')
|
epilog='Text at the bottom of help')
|
||||||
|
|
||||||
app = App(ignore_command_register=False)
|
parser.add_argument('filename') # positional argument
|
||||||
app.include_router(router)
|
parser.add_argument('-c', '--count') # option that takes a value
|
||||||
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.get_trigger()}'))
|
parser.add_argument('-v', '--verbose',
|
||||||
app.start_polling()
|
action='store_const')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
print(args)
|
||||||
|
print(args.filename, args.count, args.verbose)
|
||||||
|
|||||||
Reference in New Issue
Block a user