示例#1
0
文件: help.py 项目: crazymaik/pyimc
def execute(config, pidgin, skype, args):
	if len(args) != 1 or not args[0] in modutils.get_available_commands():
		usage()
		return
	cmd = args[0]
	mod = modutils.load_command_module(cmd)
	print 'Help for command "%s"' % cmd
	print 'Usage: pyimc %s %s' % (cmd, mod.arg_format)
	print mod.short_description
	print mod.long_description
示例#2
0
文件: main.py 项目: crazymaik/pyimc
def main():
	config = Config()
	bus = dbus.SessionBus()

	pidgin = PidginWrapper(bus) if config.pidgin == 'True' else None
	skype = SkypeWrapper(bus) if config.skype == 'True' else None

	if len(sys.argv) <= 1:
		usage()
		return -1

	action = sys.argv[1]
	args = sys.argv[2:]

	mod = modutils.load_command_module(action)
	if mod == None:
		print "ERROR: Unknown command '%s'" % action
		usage()
		return -1

	mod.execute(config, pidgin, skype, args)

	return 0
示例#3
0
文件: help.py 项目: crazymaik/pyimc
def usage():
	print 'USAGE: pyimc <command> [<args>]'
	print 'Supported commands:'
	for m in modutils.get_available_commands():
		mod = modutils.load_command_module(m)
		print '    %-10s %s' % (m, mod.short_description)