pidgin/purple-plugin-pack

clean up the help strings and other related stuff
org.guifications.plugins.buildsystem_rewrite
2008-04-27, grim
07f0fe5b628e
Parents 2a22ffd73469
Children c2d055a16581
clean up the help strings and other related stuff
  • +22 -10
    plugin_pack.py
  • --- a/plugin_pack.py Sun Apr 27 00:50:56 2008 -0400
    +++ b/plugin_pack.py Sun Apr 27 04:48:01 2008 -0400
    @@ -19,6 +19,8 @@
    """Usage: plugin_pack.py [OPTION...] command
    +Flags:
    +
    -a Load abusive plugins
    -d Load default plugins
    -f Load finch plugins
    @@ -27,9 +29,6 @@
    -P Load pidgin plugins
    Commands:
    -
    - dependency-graph Outputs a graphviz script of the plugin's dependencies
    - info <plugin> Display information about plugin.
    """
    import ConfigParser
    @@ -191,6 +190,7 @@
    return dirs
    def help(self, args):
    + """Displays information about other commands"""
    try:
    cmd = self.commands[args[0]]
    print cmd.__doc__
    @@ -201,7 +201,7 @@
    commands['help'] = help
    def dist_dirs(self, args):
    - """Outputs a list of all plugin directories to included in the distribution"""
    + """Displays a list of all plugin directories to included in the distribution"""
    print string.join(self.unique_dirs(), ' ')
    commands['dist_dirs'] = dist_dirs
    @@ -214,7 +214,7 @@
    commands['config_file'] = config_file
    def dependency_graph(self, args):
    - """Outputs a graphviz script of dependencies"""
    + """Outputs a graphviz script showing plugin dependencies"""
    def node_label(plugin):
    node = plugin.provides.replace('-', '_')
    label = plugin.name
    @@ -273,7 +273,7 @@
    commands['dependency_graph'] = dependency_graph
    def info(self, args):
    - """Outputs all information about the given plugins"""
    + """Displays all information about the given plugins"""
    for p in args:
    try:
    print self.plugins[p].__str__().strip()
    @@ -284,6 +284,7 @@
    commands['info'] = info
    def stats(self, args):
    + """Displays stats about the plugin pack"""
    counts = {}
    counts['total'] = len(self.plugins)
    @@ -312,6 +313,19 @@
    print " pidgin: %s" % (value(counts['pidgin']))
    commands['stats'] = stats
    +def show_usage(pp, exitcode):
    + print __doc__
    +
    + cmds = pp.commands.keys()
    + cmds.sort()
    +
    + for cmd in cmds:
    + print " %-20s %s" % (cmd, pp.commands[cmd].__doc__)
    +
    + print ""
    +
    + sys.exit(exitcode)
    +
    def main():
    # create our main instance
    pp = PluginPack()
    @@ -325,8 +339,7 @@
    opts, args = getopt.getopt(sys.argv[1:], shortopts)
    except getopt.error, msg:
    print msg
    - print __doc__
    - sys.exit(1)
    + show_usage(pp, 1)
    for o, a in opts:
    if o == '-a':
    @@ -347,8 +360,7 @@
    pp.load_plugins(types, depends)
    if(len(args) == 0):
    - print __doc__
    - sys.exit(1)
    + show_usage(pp, 1)
    cmd = args[0]
    args = args[1:]