Make 'deluge -u null' launch the null client.

This commit is contained in:
Sadrul Habib Chowdhury 2008-02-10 09:40:14 +00:00
parent 4eabde05ff
commit 5f40e030b1
2 changed files with 26 additions and 20 deletions

View File

@ -219,25 +219,27 @@ commands = (('add', add_torrent, 'Add a torrent'),
client.set_core_uri("http://localhost:58846") client.set_core_uri("http://localhost:58846")
print "Welcome to deluge-shell. Type 'help' to see a list of available commands." class NullUI:
def __init__(self, args):
print "Welcome to deluge-shell. Type 'help' to see a list of available commands."
readline.read_init_file() readline.read_init_file()
while True: while True:
inp = raw_input("> ") inp = raw_input("> ")
if len(inp) == 0: break if len(inp) == 0: break
inp = inp.strip().split(" ") inp = inp.strip().split(" ")
print "" print ""
cmd = inp[0] cmd = inp[0]
found = False found = False
for command, action, help in commands: for command, action, help in commands:
if command != cmd: if command != cmd:
continue continue
action(inp) action(inp)
found = True found = True
break break
if not found: if not found:
print "Invalid command!" print "Invalid command!"
show_help([]) show_help([])
print "Thanks." print "Thanks."

View File

@ -59,4 +59,8 @@ class UI:
log.info("Starting WebUI..") log.info("Starting WebUI..")
from deluge.ui.webui.webui import WebUI from deluge.ui.webui.webui import WebUI
ui = WebUI(args) ui = WebUI(args)
elif selected_ui == "null":
log.info("Starting NullUI..")
from deluge.ui.null.deluge_shell import NullUI
ui = NullUI(args)