-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager-1.py
34 lines (23 loc) · 875 Bytes
/
manager-1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import asyncio
from fastapi import FastAPI
from fastapi_script import Manager
app = FastAPI()
manager = Manager(app)
@manager.command
async def test_without_params():
print('test_without_params')
@manager.command
async def test_one_params(name):
print(f'test_one_params, name: {name}')
@manager.command
async def test_many_params(name, age=0):
print(f'test_many_params, name: {name}, age: {age}')
@manager.option('-n', '--name', dest='name', help='input your name')
async def option_one_params(name):
print(f'option_one_params, name: {name}')
@manager.option('-n', '--name', dest='name', help='input your name')
@manager.option('-s', '--score', dest='score', help='input your score')
async def option_many_params(name, score):
print(f'option_many_params, name: {name}, score: {score}')
if __name__ == '__main__':
asyncio.run(manager.run())