URI: 
       tcmdline: read all arguments before parsing - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 89677c47f78c0b762106c575df952376328805e1
   DIR parent fa9ce51685dda32b2e78444d8414946f6f0f8b93
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Mon, 17 Aug 2015 09:46:50 +0200
       
       cmdline: read all arguments before parsing
       
       Diffstat:
         M electrum                            |      35 +++++++++++++++----------------
       
       1 file changed, 17 insertions(+), 18 deletions(-)
       ---
   DIR diff --git a/electrum b/electrum
       t@@ -201,20 +201,6 @@ def run_cmdline(config):
            # options
            args += map(lambda x: config.get(x), cmd.options)
        
       -    # pipe data
       -    for i, arg in enumerate(args):
       -        if arg == '-':
       -            if not sys.stdin.isatty():
       -                pipe_data = sys.stdin.read()
       -                try:
       -                    pipe_data = json.loads(pipe_data)
       -                except:
       -                    pass
       -                args[i] = pipe_data
       -                break
       -            else:
       -                raise BaseException('Cannot get argument from stdin')
       -
            # instanciate wallet for command-line
            storage = WalletStorage(config.get_wallet_path())
        
       t@@ -383,6 +369,23 @@ if __name__ == '__main__':
                sys.argv.remove('help')
                sys.argv.append('-h')
        
       +    # read arguments from stdin pipe and prompt
       +    for i, arg in enumerate(sys.argv):
       +        if arg == '-':
       +            if not sys.stdin.isatty():
       +                pipe_data = sys.stdin.read()
       +                try:
       +                    pipe_data = json.loads(pipe_data)
       +                except:
       +                    pass
       +                sys.argv[i] = pipe_data
       +                break
       +            else:
       +                raise BaseException('Cannot get argument from stdin')
       +        elif arg == '?':
       +            sys.argv[i] = prompt_password('Enter argument (will not echo):', False)
       +
       +    # parse cmd line
            parser = get_parser(run_gui, run_daemon, run_cmdline)
            args = parser.parse_args()
        
       t@@ -404,10 +407,6 @@ if __name__ == '__main__':
            if config_options.get('portable'):
                config_options['electrum_path'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')
        
       -    # If private key is passed on the command line, '?' triggers prompt.
       -    if config_options.get('privkey') and config_options['privkey'] == '?':
       -        config_options['privkey'] = prompt_password('Enter PrivateKey (will not echo):', False)
       -
            set_verbosity(config_options.get('verbose'))
            config = SimpleConfig(config_options)