emsm.core.argparse_

This module contains the ArgumentParser class which wraps a Python argparse.ArgumentParser for the EMSM.

class emsm.core.argparse_.LongHelpAction(option_strings, description=None, dest='==SUPPRESS==', default='==SUPPRESS==')[source]

Bases: argparse.Action

Prints the description using less (if available) and exists.

class emsm.core.argparse_.ArgumentParser(app)[source]

Bases: object

Wraps an argparse.ArgumentParser instance.

This class handles the root EMSM argument parser. The root parser only has a few global EMSM commands like -w, -s. Each plugin has its own subparser:

$ foo@bar: minecraft [emsm args] (plugin_name) [plugin args]

Example:

# Call the *worlds* plugin with the world *foo* as target.
$ foo@bar: minecraft -w foo worlds --status
argparser()[source]

Returns the wrapped argparse.ArgumentParser instance.

args(cache=True)[source]

Parses (if not yet done) the command line arguments and returns a namespace object that contains the result.

Parameters:cache (bool) – If True, and the arguments have already been parsed, the result of the previous parse is returned.
plugin_parser(plugin_name)[source]

Returns the subparser for the plugin with the name plugin_name.

setup()[source]

Adds the global EMSM arguments to the root argument parser.

This method has to be called, when the WorldManager and ServerManager have been loaded, since we require the names of the available worlds and server.