Coverage for src/bin/bindctl/moduleinfo : 71%
        
        
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
| 
 # Copyright (C) 2009 Internet Systems Consortium. # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
 parameters for use in bindctl""" 
 
 except ImportError: from bindctl.mycollections import OrderedDict 
 # Define value type 
 
 # this is used to align the descriptions in help output 
 
 """One parameter of one command. Each command parameter has five attributes: parameter name, parameter type, parameter value, parameter description and paramter's spec(got from module spec file). """ optional = False, value = '', default_value = '', param_spec = None): 
 return str("\t%s <type: %s> \t(%s)" % (self.name, self.type, self.desc)) 
 if self.is_optional: opt_str = "optional" else: opt_str = "mandatory" return "%s (%s, %s)" % (self.name, self.type, opt_str) 
 return self.desc 
 """One command which is provided by one bind10 module, it has zero or more parameters """ 
 # Set default parameter "help" desc = "Get help for command.", optional = True)) 
 return str("%s \t(%s)" % (self.name, self.desc)) 
 return self.name 
 return self.desc; 
 """Add a ParamInfo object to this CommandInfo""" 
 
 """Returns true if the parameter with param_name exists""" return param_name in self.params 
 
 """Returns the ParamInfo with the given name. Raises a KeyError if it doesn't exist""" 
 
 """Returns a list of all ParamInfo objects for this CommandInfo""" return list(self.params.values()) 
 
 """Returns a list of the names of all parameters for this command""" 
 
 """Returns a list of the names of all mandatory parameters for this command""" if not self.params[name].is_optional] 
 """ Find a proper parameter name for the position 'pos': If param_count is equal to the count of mandatory parameters of command, and there is some optional parameter, find the first mandatory parameter from the position 'pos' to the end. Else, return the name on position pos. (This function will be changed if bindctl command line syntax is changed in the future. ) """ raise KeyError(str(pos) + " is not an integer") 
 else: 
 
 raise KeyError(str(pos) + "parameters have error") else: 
 
 """Prints the help info for this command to stdout""" print("Command ", self) print("\t\thelp (Get help for command)") 
 params = self.params.copy() del params["help"] 
 if len(params) == 0: print("This command has no parameters") return 
 print("Parameters:") for info in params.values(): print(" %s" % info.get_basic_info()) description = info.get_desc() if description != "": print(textwrap.fill(description, initial_indent=" ", subsequent_indent=" ", width=70)) 
 """Define the information of one module, include module name, module supporting commands. """ 
 desc = "Get help for module.")) 
 return str("%s \t%s" % (self.name, self.desc)) 
 return self.name 
 return self.desc 
 """Add a CommandInfo to this ModuleInfo.""" 
 """Returns true if this module has a command with the given name.""" 
 """Returns the CommandInfo for the command with the given name. Raises a KeyError if not found""" 
 """Returns a list of all CommandInfo objects for this module.""" return list(self.commands.values()) 
 """Returns a list of the names of all commands for this module.""" 
 """Prints the help info for this module to stdout""" print("Module ", self, "\nAvailable commands:") for k in self.commands.values(): n = k.get_name() if len(n) >= CONST_BINDCTL_HELP_INDENT_WIDTH: print(" %s" % n) print(textwrap.fill(k.get_desc(), initial_indent=" ", subsequent_indent=" " + " " * CONST_BINDCTL_HELP_INDENT_WIDTH, width=70)) else: print(textwrap.fill("%s%s%s" % (k.get_name(), " "*(CONST_BINDCTL_HELP_INDENT_WIDTH - len(k.get_name())), k.get_desc()), initial_indent=" ", subsequent_indent=" " + " " * CONST_BINDCTL_HELP_INDENT_WIDTH, width=70)) 
 """Prints the help info for the command with the given name. Raises KeyError if not found""" self.commands[command].command_help() 
  |