From 594e6f6a9ef2aab54deba1c8668bce5a6bc777c7 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 15 Jan 2020 22:06:30 -0800 Subject: [PATCH] Add stubs for initial command set --- amanuensis/cli/lexicon.py | 111 ++++++++++++++++++++++++++++++++++++-- amanuensis/cli/user.py | 22 ++++++-- 2 files changed, 125 insertions(+), 8 deletions(-) diff --git a/amanuensis/cli/lexicon.py b/amanuensis/cli/lexicon.py index 2df1316..a3f76c1 100644 --- a/amanuensis/cli/lexicon.py +++ b/amanuensis/cli/lexicon.py @@ -1,6 +1,109 @@ -from cli.helpers import add_argument, no_argument +from cli.helpers import add_argument, no_argument, requires + +# +# CRUD commands +# @no_argument -def command_noop(args): - """noop""" - pass \ No newline at end of file +@requires("lexicon") +def command_create(args): + """ + Create a lexicon + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_delete(args): + """ + Delete a lexicon and all its data + """ + raise NotImplementedError() + +@no_argument +def command_list(args): + """ + List all lexicons and their statuses + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_config(args): + """ + Interact with a lexicon's config + """ + raise NotImplementedError() + +# +# Player/character commands +# + +@no_argument +@requires("lexicon") +def command_player_add(args): + """ + Add a player to a lexicon + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_player_remove(args): + """ + Remove a player from a lexicon + + Removing a player dissociates them from any characters + they control but does not delete any character data. + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_player_list(args): + """ + List all players in a lexicon + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_char_create(args): + """ + Create a character for a lexicon + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_char_delete(args): + """ + Delete a character from a lexicon + + Deleting a character dissociates them from any content + they have contributed rather than deleting it. + """ + raise NotImplementedError() + +@no_argument +@requires("lexicon") +def command_char_list(args): + """ + List all characters in a lexicon + """ + raise NotImplementedError() + +# +# Procedural commands +# + +@no_argument +@requires("lexicon") +def command_publish_turn(args): + """ + Publishes the current turn of a lexicon + + Ability to publish is checked against the lexicon's + turn publish policy unless --force is specified. + """ + raise NotImplementedError() \ No newline at end of file diff --git a/amanuensis/cli/user.py b/amanuensis/cli/user.py index d95dfc4..576b751 100644 --- a/amanuensis/cli/user.py +++ b/amanuensis/cli/user.py @@ -3,8 +3,10 @@ from cli.helpers import add_argument, no_argument @add_argument("--username", help="User's login handle") @add_argument("--displayname", help="User's publicly displayed name") @add_argument("--email", help="User's email") -def command_add(args): - """Creates a user""" +def command_create(args): + """ + Create a user + """ import json import user @@ -34,6 +36,9 @@ def command_add(args): @add_argument("--id", help="id of user to delete") def command_delete(args): + """ + Delete a user + """ import os import config @@ -50,7 +55,7 @@ def command_delete(args): @no_argument def command_list(args): - """Lists users""" + """List all users""" import os import config @@ -65,9 +70,18 @@ def command_list(args): for user in users: print("{0} {1} ({2})".format(user['uid'], user['displayname'], user['username'])) +@no_argument +def command_config(args): + """ + Interact with a user's config + """ + raise NotImplementedError() + @add_argument("--username", help="The user to change password for") def command_passwd(args): - """Set a user's password""" + """ + Set a user's password + """ import getpass import os