我正在尝试@hug.extend_api()
用于 CLI 路由,但它不起作用。
调用hug -f run.py -c something
,命令列表为空。相同的代码适用于 HTTP 路由。
这是我的主要脚本(run.py
):
import hug
from apitest import api
@hug.extend_api()
def apis():
return [api]
这是apitest/api.py
:
import hug
@hug.cli() # cli route doesn't work
@hug.get('/') # get route works fine
def root():
return 'hello'