add option to flask scodoc-database
This commit is contained in:
parent
f619dfec36
commit
a455a61910
18
scodoc.py
18
scodoc.py
|
@ -275,10 +275,20 @@ def list_depts(depts=""): # list-dept
|
|||
|
||||
|
||||
@app.cli.command()
|
||||
def scodoc_database_uri(): # list-dept
|
||||
"""print the database_uril
|
||||
"""
|
||||
print(app.config["SQLALCHEMY_DATABASE_URI"])
|
||||
@click.option(
|
||||
"-n",
|
||||
"--name",
|
||||
is_flag=True,
|
||||
help="show database name instead of connexion string (required for "
|
||||
"dropdb/createddb commands)",
|
||||
)
|
||||
def scodoc_database(name): # list-dept
|
||||
"""print the database connexion string"""
|
||||
uri = app.config["SQLALCHEMY_DATABASE_URI"]
|
||||
if name:
|
||||
print(uri.split("/")[-1])
|
||||
else:
|
||||
print(uri)
|
||||
|
||||
|
||||
@app.cli.command()
|
||||
|
|
Loading…
Reference in New Issue
Block a user