pyinvoke / invoke

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

How can I obfuscate specific strings in output to hide secrets? #873

Open red8888 opened 1 year ago

red8888 commented 1 year ago

There are some commands I run with invoke that offer no built in secrets obfuscation features.

Is there a way to have invoke replace specific strings when it outputs to console with "**"?

I'd like to not have to set hide=False, capture the entire output, do a replace on the entire text and then output it all at once.

It would be better if invoke could do that in real time when its returning the output of a running command.

Is this possible?

Thanks!