Add ability to send arguments to UIs with -a, --args
This commit is contained in:
parent
26eb2bbb3d
commit
2d257371d9
|
@ -55,6 +55,8 @@ def start_ui():
|
|||
help="Set the config location", action="store", type="str")
|
||||
parser.add_option("-l", "--logfile", dest="logfile",
|
||||
help="Output to designated logfile instead of stdout", action="store", type="str")
|
||||
parser.add_option("-a", "--args", dest="args",
|
||||
help="Arguments to pass to UI, -a '--option args'", action="store", type="str")
|
||||
|
||||
# Get the options and args from the OptionParser
|
||||
(options, args) = parser.parse_args()
|
||||
|
@ -93,10 +95,11 @@ def start_ui():
|
|||
log.info("Deluge ui %s", version)
|
||||
log.debug("options: %s", options)
|
||||
log.debug("args: %s", args)
|
||||
log.debug("ui_args: %s", args)
|
||||
|
||||
from deluge.ui.ui import UI
|
||||
log.info("Starting ui..")
|
||||
UI(options, args)
|
||||
UI(options, args, options.args)
|
||||
|
||||
def start_daemon():
|
||||
"""Entry point for daemon script"""
|
||||
|
@ -167,4 +170,3 @@ def start_daemon():
|
|||
|
||||
from deluge.core.daemon import Daemon
|
||||
Daemon(options, args)
|
||||
|
||||
|
|
|
@ -96,7 +96,11 @@ class NullUI(object):
|
|||
def __init__(self, args=None):
|
||||
client.set_core_uri("http://localhost:58846")
|
||||
self._commands = load_commands(os.path.join(UI_PATH, 'commands'))
|
||||
|
||||
if args:
|
||||
self.precmd()
|
||||
self.onecmd(args)
|
||||
self.postcmd()
|
||||
sys.exit(0)
|
||||
|
||||
def completedefault(self, *ignored):
|
||||
"""Method called to complete an input line when no command-specific
|
||||
|
|
|
@ -40,7 +40,7 @@ DEFAULT_PREFS = {
|
|||
}
|
||||
|
||||
class UI:
|
||||
def __init__(self, options, args):
|
||||
def __init__(self, options, args, ui_args):
|
||||
log.debug("UI init..")
|
||||
|
||||
# Set the config directory
|
||||
|
@ -71,6 +71,4 @@ class UI:
|
|||
elif selected_ui == "null2":
|
||||
log.info("Starting NullUI2..")
|
||||
from deluge.ui.null2.main import NullUI
|
||||
ui = NullUI(args)
|
||||
ui.run()
|
||||
|
||||
ui = NullUI(ui_args).run()
|
||||
|
|
Loading…
Reference in New Issue