Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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)