def help(self, warning=False): warning = 'See "ceph-volume --help" for full list of options.' if warning else '' return self._help.format( warning=warning, log_path=conf.log_path, ceph_path=self.stat_ceph_conf(), plugins=self.plugin_help, sub_help=terminal.subhelp(self.mapper), environ_vars=self.get_environ_vars() )
def main(self): terminal.dispatch(self.mapper, self.argv) parser = argparse.ArgumentParser( prog='ceph-volume lvm', formatter_class=argparse.RawDescriptionHelpFormatter, description=self.print_help(terminal.subhelp(self.mapper)), ) parser.parse_args(self.argv) if len(self.argv) <= 1: return parser.print_help()
def test_has_title_header(self): result = terminal.subhelp({'sub': SubCommand}) assert 'Available subcommands:' in result
def test_single_level_help(self): result = terminal.subhelp({'sub': SubCommand}) assert 'this is the subcommand help' in result
def test_no_sub_command_help(self): assert terminal.subhelp({}) == ''
def test_command_with_no_help(self): class SubCommandNoHelp(object): pass result = terminal.subhelp({'sub': SubCommandNoHelp}) assert result == ''