CommandItem

Bases: consolemenu.items.ExternalItem

class consolemenu.items.CommandItem(text, command, arguments=None, menu=None, should_exit=False, menu_char=None)[source]

A menu item to execute a console command

Variables:
  • text (str) – The text shown for this menu item
  • command (str) – The console command to be executed
  • arguments (list[str]) – An optional list of string arguments to be passed to the command
  • menu (ConsoleMenu) – The menu to which this item belongs
  • should_exit (bool) – Whether the menu should exit once this item’s action is done
  • menu_char (str) – The character used to select this menu item. Optional - defaults to None.
action()[source]

This class overrides this method

get_return()[source]
Returns:the exit status of the command
Return type:int