mnager option order switch
This commit is contained in:
@@ -21,15 +21,15 @@
|
|||||||
[preview](http://localhost:8041/preview/my_poll)
|
[preview](http://localhost:8041/preview/my_poll)
|
||||||
- Change to `draft: false` to enable voting
|
- Change to `draft: false` to enable voting
|
||||||
- Add tokens for the vote:
|
- Add tokens for the vote:
|
||||||
`./manager token --prefix http://localhost:8041 my_poll`
|
`./manager my_poll token --prefix http://localhost:8041`
|
||||||
- Open the link to vote
|
- Open the link to vote
|
||||||
- Get summary of votes: `./manager summary my_poll`
|
- Get summary of votes: `./manager my_poll summary`
|
||||||
|
|
||||||
## Additional usage
|
## Additional usage
|
||||||
|
|
||||||
During the poll, you can observe the vote counts:
|
During the poll, you can observe the vote counts:
|
||||||
- Add an observer token:
|
- Add an observer token:
|
||||||
`./manager token --prefix http://localhost:8041 --role observer my_poll`
|
`./manager my_poll token --prefix http://localhost:8041 --role observer`
|
||||||
- Open the link to see vote counts
|
- Open the link to see vote counts
|
||||||
- If the question se allows voters to see results after casting their vote
|
- If the question se allows voters to see results after casting their vote
|
||||||
`show_results: true`, then observer can also see the results.
|
`show_results: true`, then observer can also see the results.
|
||||||
|
|||||||
42
manager.py
42
manager.py
@@ -83,9 +83,14 @@ def parse_options(database, questions):
|
|||||||
help = "Path to database [%(default)s]")
|
help = "Path to database [%(default)s]")
|
||||||
parser.add_argument('--questions', action="store", dest="questions", default = default_questions,
|
parser.add_argument('--questions', action="store", dest="questions", default = default_questions,
|
||||||
help = "Path to question folder [%(default)s]")
|
help = "Path to question folder [%(default)s]")
|
||||||
|
parser.add_argument(
|
||||||
|
dest = "name",
|
||||||
|
help = "Name of the question set",
|
||||||
|
nargs = '?',
|
||||||
|
default = None
|
||||||
|
)
|
||||||
|
|
||||||
|
subparsers = parser.add_subparsers(help='sub-command', dest='subparser_name')
|
||||||
subparsers = parser.add_subparsers(help='sub-command help', dest='subparser_name')
|
|
||||||
## tokens
|
## tokens
|
||||||
parser_token = subparsers.add_parser('token', help = "Manage tokens")
|
parser_token = subparsers.add_parser('token', help = "Manage tokens")
|
||||||
parser_token.add_argument(
|
parser_token.add_argument(
|
||||||
@@ -117,10 +122,7 @@ def parse_options(database, questions):
|
|||||||
default = False,
|
default = False,
|
||||||
help = "List existing tokens, instead of generating more"
|
help = "List existing tokens, instead of generating more"
|
||||||
)
|
)
|
||||||
parser_token.add_argument(
|
|
||||||
dest = "name",
|
|
||||||
help = "Name of the question set"
|
|
||||||
)
|
|
||||||
|
|
||||||
## summary of vote
|
## summary of vote
|
||||||
parser_summary = subparsers.add_parser('summary', help = "Vote results")
|
parser_summary = subparsers.add_parser('summary', help = "Vote results")
|
||||||
@@ -131,12 +133,9 @@ def parse_options(database, questions):
|
|||||||
default = False,
|
default = False,
|
||||||
help = "TSV output"
|
help = "TSV output"
|
||||||
)
|
)
|
||||||
parser_summary.add_argument(
|
|
||||||
dest = "name",
|
|
||||||
help = "Name of the question set"
|
|
||||||
)
|
|
||||||
## clear
|
## clear
|
||||||
parser_clear_votes = subparsers.add_parser('clear_votes', help = "Delete results")
|
parser_clear_votes = subparsers.add_parser('clear-votes', help = "Delete results")
|
||||||
parser_clear_votes.add_argument(
|
parser_clear_votes.add_argument(
|
||||||
'--really',
|
'--really',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@@ -144,13 +143,9 @@ def parse_options(database, questions):
|
|||||||
default = False,
|
default = False,
|
||||||
help = "Really delete results for the vote"
|
help = "Really delete results for the vote"
|
||||||
)
|
)
|
||||||
parser_clear_votes.add_argument(
|
|
||||||
dest = "name",
|
|
||||||
help = "Name of the question set"
|
|
||||||
)
|
|
||||||
|
|
||||||
## clear tokens
|
## clear tokens
|
||||||
parser_clear_tokens = subparsers.add_parser('clear_tokens', help = "Delete tokens")
|
parser_clear_tokens = subparsers.add_parser('clear-tokens', help = "Delete tokens")
|
||||||
parser_clear_tokens.add_argument(
|
parser_clear_tokens.add_argument(
|
||||||
'--really',
|
'--really',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@@ -158,17 +153,12 @@ def parse_options(database, questions):
|
|||||||
default = False,
|
default = False,
|
||||||
help = "Really delete tokens for the vote"
|
help = "Really delete tokens for the vote"
|
||||||
)
|
)
|
||||||
parser_clear_tokens.add_argument(
|
|
||||||
dest = "name",
|
|
||||||
help = "Name of the question set"
|
|
||||||
)
|
|
||||||
|
|
||||||
## list
|
|
||||||
parser_list = subparsers.add_parser('list', help = "List all question set names")
|
|
||||||
|
|
||||||
parsed = parser.parse_args()
|
parsed = parser.parse_args()
|
||||||
if parsed.subparser_name == None:
|
if parsed.name == None:
|
||||||
parser.print_help()
|
print("Names of question sets:")
|
||||||
|
list_question_sets(parsed)
|
||||||
|
sys.exit(0)
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
@@ -285,8 +275,6 @@ def clear_tokens(options):
|
|||||||
|
|
||||||
def main(database, questions):
|
def main(database, questions):
|
||||||
options = parse_options(database, questions)
|
options = parse_options(database, questions)
|
||||||
if options.subparser_name == "list":
|
|
||||||
list_question_sets(options)
|
|
||||||
if options.subparser_name == "token":
|
if options.subparser_name == "token":
|
||||||
manage_tokens(options)
|
manage_tokens(options)
|
||||||
if options.subparser_name == "summary":
|
if options.subparser_name == "summary":
|
||||||
|
|||||||
Reference in New Issue
Block a user