1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 10:39:00 +00:00
trezor-firmware/core
matejcik 4c8c96272c emu: fix flag options with defaults
Click REALLY INSISTS you provide on/off switches for your options.
You can use is_flag, but then the presence of the option changes based
on the default value.

Which makes sense, really:
@option("-f", "foobar", is_flag=True, default=False)
you would expect `./cli -f` to have `foobar is True`

whereas with
@option("-f", "foobar", is_flag=True, default=True)
you would expect `./cli -f` to have `foobar is False`, otherwise it's a
no-op

this becomes fun with `default=os.environ.get("SOMETHING")`, because
then the effect of the option CHANGES with a value of environment
variable!

there's two ways around this:
a) don't use defaults, update the flag explicitly, like:
   foobar = foobar or os.environ.get("FOOBAR") == "1"
b) forget about is_flag and specify an on/off switch, where the default
   value works as intended

since the latter is also technically speaking more correct, i'm doing it
2020-02-12 13:32:05 +01:00
..
assets MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
embed all: shut down emulator on error_shutdown 2020-02-12 13:31:31 +01:00
mocks core/embed: update fatfs to 0.14; use upstream version 2020-02-07 15:21:16 +00:00
prof core/prof: make sure coverage data is generated with absolute paths 2020-01-23 18:43:20 +01:00
site_scons/site_tools/micropython core: remove qstr blacklist 2020-01-07 20:52:43 +01:00
src core: do not catch SystemExit in handle_session (#826) 2020-02-12 10:36:42 +01:00
tests Merge pull request #803 from trezor/passphrase 2020-02-11 16:01:59 +01:00
tools core/headertool: support generating vendor headers with explicit size 2020-02-05 12:23:34 +01:00
vendor move vendored submodules to root vendor/ dir 2019-05-13 13:51:53 +02:00
.dockerignore MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
.gitignore core: git ignore coverage outputs 2019-06-26 22:10:05 +02:00
.pylintrc style: improve pylint exclusions 2019-05-07 16:31:04 +02:00
asan_blacklist.txt core: asan config 2019-06-27 19:09:55 +02:00
AUTHORS MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
ChangeLog core: properly limit passphrase to 50 bytes 2020-02-11 15:39:08 +00:00
COPYING MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
emu.py emu: fix flag options with defaults 2020-02-12 13:32:05 +01:00
emu.sh core: convert emu.sh to a simple dependency-less compat wrapper 2020-01-23 18:43:20 +01:00
Makefile core: improve stability of Monero test runner 2020-02-11 11:16:28 +01:00
README.md docs: move docs to root 2019-12-06 12:24:20 +00:00
SConscript.boardloader core/embed: don't use local copy of inflate 2020-01-18 17:09:52 +01:00
SConscript.bootloader core+legacy: use nanopb generator from pipenv 2020-02-04 17:15:25 +00:00
SConscript.firmware core/tools: drop tools obsoleted by headertool 2020-01-20 17:32:59 +01:00
SConscript.prodtest core/tools: drop tools obsoleted by headertool 2020-01-20 17:32:59 +01:00
SConscript.reflash core/tools: drop tools obsoleted by headertool 2020-01-20 17:32:59 +01:00
SConscript.unix core/embed: don't use local copy of inflate 2020-01-18 17:09:52 +01:00
SConstruct MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
trezor.sdcard.gz core: introduce emulator runner (fixes #466) 2020-01-23 18:43:20 +01:00

Trezor Core

Firmware currently running on Model T.

See docs/core for more info.