URI: 
       treplace daemon 'start' subdommand with -d - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 7f870f5e096cbc3296a091cd3e62c2733515f330
   DIR parent 241a37d12da9de336836be52b2d1ff04677788e9
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Mon,  2 Sep 2019 19:04:08 +0200
       
       replace daemon 'start' subdommand with -d
       
       Diffstat:
         M electrum/commands.py                |       3 +--
         M electrum/daemon.py                  |      12 ------------
         M electrum/tests/regtest/regtest.sh   |      20 ++++++++++----------
         M run_electrum                        |      49 +++++++++++++------------------
       
       4 files changed, 32 insertions(+), 52 deletions(-)
       ---
   DIR diff --git a/electrum/commands.py b/electrum/commands.py
       t@@ -1139,8 +1139,7 @@ def get_parser():
            add_global_options(parser_gui)
            # daemon
            parser_daemon = subparsers.add_parser('daemon', help="Run Daemon")
       -    parser_daemon.add_argument("subcommand", choices=['start', 'status', 'stop', 'load_wallet', 'close_wallet'], nargs='?')
       -    #parser_daemon.set_defaults(func=run_daemon)
       +    parser_daemon.add_argument("-d", "--detached", action="store_true", dest="detach", default=False, help="run daemon in detached mode")
            add_network_options(parser_daemon)
            add_global_options(parser_daemon)
            # commands
   DIR diff --git a/electrum/daemon.py b/electrum/daemon.py
       t@@ -243,7 +243,6 @@ class Daemon(Logger):
                self.methods = jsonrpcserver.methods.Methods()
                self.methods.add(self.ping)
                self.methods.add(self.gui)
       -        self.methods.add(self.daemon)
                self.cmd_runner = Commands(self.config, None, self.network, self)
                for cmdname in known_commands:
                    self.methods.add(getattr(self.cmd_runner, cmdname))
       t@@ -261,17 +260,6 @@ class Daemon(Logger):
            async def ping(self):
                return True
        
       -    async def daemon(self, config_options):
       -        config = SimpleConfig(config_options)
       -        sub = config.get('subcommand')
       -        assert sub in [None, 'start', 'stop']
       -        if sub in [None, 'start']:
       -            response = "Daemon already running"
       -        elif sub == 'stop':
       -            self.stop()
       -            response = "Daemon stopped"
       -        return response
       -
            async def gui(self, config_options):
                config = SimpleConfig(config_options)
                if self.gui_object:
   DIR diff --git a/electrum/tests/regtest/regtest.sh b/electrum/tests/regtest/regtest.sh
       t@@ -89,9 +89,9 @@ fi
        
        # start daemons. Bob is started first because he is listening
        if [[ $1 == "start" ]]; then
       -    $bob daemon start
       -    $alice daemon start
       -    $carol daemon start
       +    $bob daemon -d
       +    $alice daemon -d
       +    $carol daemon -d
            $bob load_wallet
            $alice load_wallet
            $carol load_wallet
       t@@ -158,7 +158,7 @@ fi
        
        if [[ $1 == "redeem_htlcs" ]]; then
            $bob stop
       -    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=10 $bob daemon start
       +    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=10 $bob daemon -d
            sleep 1
            $bob load_wallet
            sleep 1
       t@@ -204,7 +204,7 @@ fi
        
        if [[ $1 == "breach_with_unspent_htlc" ]]; then
            $bob stop
       -    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=3 $bob daemon start
       +    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=3 $bob daemon -d
            sleep 1
            $bob load_wallet
            wait_for_balance alice 1
       t@@ -236,7 +236,7 @@ fi
        
        if [[ $1 == "breach_with_spent_htlc" ]]; then
            $bob stop
       -    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=3 $bob daemon start
       +    ELECTRUM_DEBUG_LIGHTNING_SETTLE_DELAY=3 $bob daemon -d
            sleep 1
            $bob load_wallet
            wait_for_balance alice 1
       t@@ -276,7 +276,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
            # (to_local needs to_self_delay blocks; htlc needs whatever we put in invoice)
            new_blocks 150
            $alice stop
       -    $alice daemon start
       +    $alice daemon -d
            sleep 1
            $alice load_wallet -w /tmp/alice/regtest/wallets/toxic_wallet
            # wait until alice has spent both ctx outputs
       t@@ -285,7 +285,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
            wait_until_spent $ctx_id 1
            new_blocks 1
            echo "bob comes back"
       -    $bob daemon start
       +    $bob daemon -d
            sleep 1
            $bob load_wallet
            wait_for_balance bob 0.049
       t@@ -299,8 +299,8 @@ if [[ $1 == "watchtower" ]]; then
            $alice setconfig --offline watchtower_url http://127.0.0.1:12345
            $carol setconfig --offline watchtower_host 127.0.0.1
            $carol setconfig --offline watchtower_port 12345
       -    $carol daemon start
       -    $alice daemon start
       +    $carol daemon -d
       +    $alice daemon -d
            sleep 1
            $alice load_wallet
            wait_for_balance alice 1
   DIR diff --git a/run_electrum b/run_electrum
       t@@ -327,7 +327,6 @@ if __name__ == '__main__':
            config = SimpleConfig(config_options)
        
            cmdname = config.get('cmd')
       -    subcommand = config.get('subcommand')
        
            if config.get('testnet'):
                constants.set_testnet()
       t@@ -338,7 +337,7 @@ if __name__ == '__main__':
            elif config.get('lightning') and not config.get('reckless'):
                raise Exception('lightning branch not available on mainnet')
        
       -    if cmdname == 'daemon' and subcommand == 'start':
       +    if cmdname == 'daemon' and config.get("detach"):
                # fork before creating the asyncio event loop
                pid = os.fork()
                if pid:
       t@@ -370,32 +369,26 @@ if __name__ == '__main__':
        
            elif cmdname == 'daemon':
        
       -        if subcommand in [None, 'start']:
       -            configure_logging(config)
       -            fd = daemon.get_file_descriptor(config)
       -            if fd is not None:
       -                # run daemon
       -                init_plugins(config, 'cmdline')
       -                d = daemon.Daemon(config, fd)
       -                if config.get('websocket_server'):
       -                    from electrum import websockets
       -                    websockets.WebSocketServer(config, d.network)
       -                if config.get('requests_dir'):
       -                    path = os.path.join(config.get('requests_dir'), 'index.html')
       -                    if not os.path.exists(path):
       -                        print("Requests directory not configured.")
       -                        print("You can configure it using https://github.com/spesmilo/electrum-merchant")
       -                        sys_exit(1)
       -                d.run_daemon()
       -                sys_exit(0)
       -            else:
       -                result = daemon.request(config, 'daemon', (config_options,))
       +        configure_logging(config)
       +        fd = daemon.get_file_descriptor(config)
       +        if fd is not None:
       +            # run daemon
       +            init_plugins(config, 'cmdline')
       +            d = daemon.Daemon(config, fd)
       +            if config.get('websocket_server'):
       +                from electrum import websockets
       +                websockets.WebSocketServer(config, d.network)
       +            if config.get('requests_dir'):
       +                path = os.path.join(config.get('requests_dir'), 'index.html')
       +                if not os.path.exists(path):
       +                    print("Requests directory not configured.")
       +                    print("You can configure it using https://github.com/spesmilo/electrum-merchant")
       +                    sys_exit(1)
       +            d.run_daemon()
       +            sys_exit(0)
                else:
       -            try:
       -                result = daemon.request(config, 'daemon', (config_options,))
       -            except daemon.DaemonNotRunning:
       -                print_msg("Daemon not running")
       -                sys_exit(1)
       +            print_msg("Daemon already running")
       +            sys_exit(1)
            else:
                # command line
                cmd = known_commands[cmdname]
       t@@ -406,7 +399,7 @@ if __name__ == '__main__':
                    try:
                        result = daemon.request(config, 'run_cmdline', (config_options,), timeout)
                    except daemon.DaemonNotRunning:
       -                print_msg("Daemon not running; try 'electrum daemon start'")
       +                print_msg("Daemon not running; try 'electrum daemon -d'")
                        if not cmd.requires_network:
                            print_msg("To run this command without a daemon, use --offline")
                        sys_exit(1)