mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-25 09:35:16 +00:00
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")
|
help="Set the config location", action="store", type="str")
|
||||||
parser.add_option("-l", "--logfile", dest="logfile",
|
parser.add_option("-l", "--logfile", dest="logfile",
|
||||||
help="Output to designated logfile instead of stdout", action="store", type="str")
|
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
|
# Get the options and args from the OptionParser
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
@ -93,10 +95,11 @@ def start_ui():
|
|||||||
log.info("Deluge ui %s", version)
|
log.info("Deluge ui %s", version)
|
||||||
log.debug("options: %s", options)
|
log.debug("options: %s", options)
|
||||||
log.debug("args: %s", args)
|
log.debug("args: %s", args)
|
||||||
|
log.debug("ui_args: %s", args)
|
||||||
|
|
||||||
from deluge.ui.ui import UI
|
from deluge.ui.ui import UI
|
||||||
log.info("Starting ui..")
|
log.info("Starting ui..")
|
||||||
UI(options, args)
|
UI(options, args, options.args)
|
||||||
|
|
||||||
def start_daemon():
|
def start_daemon():
|
||||||
"""Entry point for daemon script"""
|
"""Entry point for daemon script"""
|
||||||
@ -167,4 +170,3 @@ def start_daemon():
|
|||||||
|
|
||||||
from deluge.core.daemon import Daemon
|
from deluge.core.daemon import Daemon
|
||||||
Daemon(options, args)
|
Daemon(options, args)
|
||||||
|
|
||||||
|
@ -96,7 +96,11 @@ class NullUI(object):
|
|||||||
def __init__(self, args=None):
|
def __init__(self, args=None):
|
||||||
client.set_core_uri("http://localhost:58846")
|
client.set_core_uri("http://localhost:58846")
|
||||||
self._commands = load_commands(os.path.join(UI_PATH, 'commands'))
|
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):
|
def completedefault(self, *ignored):
|
||||||
"""Method called to complete an input line when no command-specific
|
"""Method called to complete an input line when no command-specific
|
||||||
|
@ -40,7 +40,7 @@ DEFAULT_PREFS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class UI:
|
class UI:
|
||||||
def __init__(self, options, args):
|
def __init__(self, options, args, ui_args):
|
||||||
log.debug("UI init..")
|
log.debug("UI init..")
|
||||||
|
|
||||||
# Set the config directory
|
# Set the config directory
|
||||||
@ -71,6 +71,4 @@ class UI:
|
|||||||
elif selected_ui == "null2":
|
elif selected_ui == "null2":
|
||||||
log.info("Starting NullUI2..")
|
log.info("Starting NullUI2..")
|
||||||
from deluge.ui.null2.main import NullUI
|
from deluge.ui.null2.main import NullUI
|
||||||
ui = NullUI(args)
|
ui = NullUI(ui_args).run()
|
||||||
ui.run()
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user