diff --git a/Makefile b/Makefile index c0f251d..c81acaa 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ check:: poetry run black . --check poetry run isort . --check poetry run flake8 . --ignore=E501,W503 + bash -n *.sh lint:: isort . diff --git a/src/bipsea/bipsea.py b/src/bipsea/bipsea.py index 384bf9f..def010d 100644 --- a/src/bipsea/bipsea.py +++ b/src/bipsea/bipsea.py @@ -2,7 +2,6 @@ import logging import re -import select import sys import click @@ -307,12 +306,9 @@ def no_empty_param(name: str, val, msg="Must not be empty."): def try_for_pipe_input(): - stdin, _, _ = select.select([sys.stdin], [], [], TIMEOUT) - if stdin: - lines = sys.stdin.readlines() - if lines: - # get just the last line because there might be a warning above - return lines[-1].strip() + if not sys.stdin.isatty(): + return sys.stdin.read().strip() + return "" if __name__ == "__main__": diff --git a/test-readme.sh b/test-readme.sh index 8701a33..444c75d 100644 --- a/test-readme.sh +++ b/test-readme.sh @@ -11,20 +11,28 @@ poetry run bipsea validate --help poetry run bipsea xprv --help poetry run bipsea derive --help -poetry run bipsea mnemonic | poetry run bipsea validate +poetry run bipsea mnemonic | poetry run bipsea validate | poetry run bipsea xprv | bipsea derive -a mnemonic -n 12 -poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a mnemonic -n 12 +poetry run bipsea mnemonic -t jpn -n 15 + +poetry run bipsea mnemonic -n 12 --pretty poetry run bipsea mnemonic -t spa -n 12 | poetry run bipsea validate -f spa +poetry run bipsea mnemonic | poetry run bipsea validate + +poetry run bipsea mnemonic | poetry run bipsea validate | poetry run bipsea xprv + +poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a mnemonic -n 12 + poetry run bipsea validate -f free -m "123456123456123456" | poetry run bipsea xprv poetry run bipsea validate -f free -m "$(cat input.txt)" -poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a base85 +poetry run bipsea validate -m $MNEMONIC | poetry run bipsea xprv | poetry run bipsea derive -a base85 -poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a mnemonic -t jpn -n 12 +poetry run bipsea validate -m "$MNEMONIC" | poetry run bipsea xprv | poetry run bipsea derive -a mnemonic -t jpn -n 12 -poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a drng -n 1000 +poetry run bipsea validate -m "$MNEMONIC" | poetry run bipsea xprv | poetry run bipsea derive -a drng -n 1000 -poetry run bipsea xprv -m "$MNEMONIC" | poetry run bipsea derive -a dice -n 100 -s 6 +poetry run bipsea validate -m "$MNEMONIC" | poetry run bipsea xprv | poetry run bipsea derive -a dice -n 100 -s 6