flask-restx
flask-restx copied to clipboard
Is there a way to register commands with Namespaces?
Ask a question
I would like to register a command with a Namespace similarly to how Flask does it
For example,
import click
from ..views import api
@api.cli.command("setup")
@click.argument("name")
def create(name):
return f"Successfully created {name}"
and from my .view.py
from flask_restx import Namespace
api = Namespace("search", description="Search data with Elasticsearch.")
Running flask search create alice returns Error: No such command 'search'.; similarly running flask --help doesn't like the command in the Commands section.
Additional context N/A
I can just create a Blueprint for /api/search/cli; I don't need to hook into the Namespace object.