Create an openattic CLI that allows performing storage management tasks without using the WebUI or API directly.
The CLI should provide a feature set similar to the Web UI, by providing an abstracted interface. There should be one binary that accepts subcommands, e.g. oacmd disk list or oacmd volume create. Options common to multiple subcommands should always accept the same parameters.
The CLI should be modular and extensible - new subcommands should be easy to add as additional modules.
The article Building Simple Command Line Interfaces in Python provides a great introduction on how to structure a CLI application.
The API authentication should be possible via both username/password or an API auth token. These should be provided via command line options or via settings in a configuration file e.g. ~/.config/oacmd/oacmd.conf. This file should be created during the first usage of the tool, e.g. by calling oacmd login <url>, which will prompt for the URL, username and password. The API URL and credentials should be stored in the configuration file, but it should also be possible to provide an alternative URL or credentials via the command line to override the configuation file defaults.
Some useful Python modules that should be utilized for implementing this tool:
- blessed - a thin, practical wrapper around terminal styling, screen positioning, and keyboard input.
- configobj - for reading and writing config files
- docopt - to generate the option parser
- durga - to access the REST API
- python-prompt-toolkit - a library for building powerful interactive command lines in Python
- tabulate - to pretty print list output in tabular form
- tqdm - to display a progress bar for long-running queries/actions