Add character limit cli

This commit is contained in:
Tim Van Baak 2021-08-27 08:19:29 -07:00
parent 9f939fe57c
commit eec039c09a
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,7 @@ def command_create(args):
@add_argument("--no-public", dest="public", action="store_const", const=False)
@add_argument("--join", dest="join", action="store_const", const=True)
@add_argument("--no-join", dest="join", action="store_const", const=False)
@add_argument("--char-limit", type=int, default=None)
def command_edit(args):
"""
Update a lexicon's configuration.
@ -66,6 +67,9 @@ def command_edit(args):
elif args.join == False:
values["joinable"] = False
if args.char_limit:
values["character_limit"] = args.char_limit
result = db(update(Lexicon).where(Lexicon.name == args.name).values(**values))
LOG.info(f"Updated {result.rowcount} lexicons")
db.session.commit()