pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.32k stars 365 forks source link

Cannot override hide=out to be unhidden #844

Open icgood opened 2 years ago

icgood commented 2 years ago

I wanted my typical calls to tasks to show commands but hide command output, so I've configured defaults:

ns.configure({
    'run': {
        'echo': True,
        'hide': 'out',
    }
})

However, I cannot override this value to disable hiding in certain cases, like my CI/CD pipelines. All of these fail with the exception below:

$ invoke --hide=False
$ invoke --hide=None
$ INVOKE_RUN_HIDE= invoke
$ INVOKE_RUN_HIDE=None invoke
ValueError: 'hide' got '' which is not in (None, False, 'out', 'stdout', 'err', 'stderr', 'both', True)
... or ...
ValueError: 'hide' got 'None' which is not in (None, False, 'out', 'stdout', 'err', 'stderr', 'both', True)

I believe this is because the type casting behavior sees the current setting 'out' and so expects a string, but the only way to disable hide is with a bool or None.

Suggestion

If you add 'None' or 'False' string options to the acceptable values for hide to disable hiding, it will be possible to override it.