eth-educators / ethstaker-deposit-cli

Secure key generation for deposits
https://eth-educators.github.io/ethstaker-deposit-cli/
Creative Commons Zero v1.0 Universal
3 stars 5 forks source link

Entering 3 spaces on the mnemonic language prompt break the default #67

Closed remyroy closed 3 months ago

remyroy commented 3 months ago

At this prompt with the new-mnemonic command:

Please choose the language of the mnemonic word list ['1. 简体中文', '2. 繁體中文', '3. čeština', '4. English', '5. Italiano', '6. 한국어', '7. Português', '8. Español']:  [english]:

entering 3 spaces and enter breaks the app and returns:

[Error]     is not a valid language option
Please choose the language of the mnemonic word list ['1. 简体中文', '2. 繁體中文', '3. čeština', '4. English', '5. Italiano', '6. 한국어', '7. Português', '8. Español']:  [<function <lambda> at 0x706ec1bab600>]:

Where the default is broken and this lead to a traceback if you press enter:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/__main__.py", line 4, in <module>
    deposit.run()
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/deposit.py", line 97, in run
    cli()
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 1257, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 700, in make_context
    self.parse_args(ctx, args)
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 1048, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 1630, in handle_parse_result
    value = invoke_param_callback(self.callback, ctx, self, value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/venv/lib/python3.12/site-packages/click/core.py", line 123, in invoke_param_callback
    return callback(ctx, param, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/utils/click.py", line 104, in callback
    processed_input = processing_func(user_input)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/cli/new_mnemonic.py", line 39, in <lambda>
    lambda mnemonic_language: fuzzy_reverse_dict_lookup(mnemonic_language, MNEMONIC_LANG_OPTIONS),
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/utils/intl.py", line 102, in fuzzy_reverse_dict_lookup
    match = closest_match(text, reverse_lookup_dict.keys())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/remyroy/Projects/ethstaker-deposit-cli/ethstaker_deposit/utils/intl.py", line 88, in closest_match
    match = difflib.get_close_matches(text, options, n=1, cutoff=0.6)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/difflib.py", line 701, in get_close_matches
    s.set_seq2(word)
  File "/usr/lib/python3.12/difflib.py", line 248, in set_seq2
    self.__chain_b()
  File "/usr/lib/python3.12/difflib.py", line 280, in __chain_b
    for i, elt in enumerate(b):
                  ^^^^^^^^^^^^
TypeError: 'function' object is not iterable