Skip to content

Command line voting client argument parser #5

@sirex

Description

@sirex

First, you need to create setup.py file for internet voting library. This repository will be used for library purposes, together with basic command line client. So thing about this repository more like a library rather than command line client.

For command line script use console scripts entry point.

Use Python 3.

For command line script arguments use argparse.

Basically what you need to do is this:

$ voter <id> <subcommand>[ <arguments>]

For example:

$ voter 1 register
{'id': '1', 'command': 'register', 'args': []}

$ voter 1 verify voters
{'id': '1', 'command': 'verify voters', 'args': []}

$ voter 1 vote
{'id': '1', 'command': 'vote', 'args': []}

$ voter 1 verify my vote
{'id': '1', 'command': 'verify my vote', 'args': []}

$ voter 1 verify all votes
{'id': '1', 'command': 'verify all votes', 'args': []}

$ voter 1 count votes
{'id': '1', 'command': 'count votes', 'args': []}

As you see, subcommand can have more than one word, also there should be fixed list of known commands if an unknown command will be entered, show error message.

I would suggest to pop arguments and take voter id and subcommand and then pass arguments of subcommand to be process using argparse.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions