API - glint

Runner[([description = None[, show_usage = True[, prefix = '--']]])]

The Runner class is the core of the Glint framework it handles the routing of the commands to the correct methods.

Parameters:
  • description (string or None) – A string describing the application which will be printed out when the help command is run.
  • show_usage (bool) – A flag to specify whether to add the help command.
  • prefix (string) – The prefix used to identify optional arguments and flags.
r[key] = value

Assigns a method to be run when the command matches key, value can be one of two things:

  • A function,
  • A tuple containing a function and a description to be displayed when the help command is run.
len(r)

Returns the number of commands in the runner.

key in r

Returns if the current runner contains a command which matches key

Runner.run([args = None])

This method parses the arguments which are passed to it and runs the appropriate command. If the args parameter is None then run will use sys.argv.

Parameters:args (List or None) – The arguments used to determine what command to run.
Runner.help([command = None])

This method returns a list of strings which contains help information. If the show_usage flag is true then this information will first be printed to stdout. If the command argument is not none then it will return help information specific to that command.

Parameters:command (string or None) – The command to retrieve help information about.
Return type:list of strings.

Project Versions

Previous topic

Inheritance

This Page