Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
Former Member
4 years ago[68] op run: no color output
I am running some interactive scripts that usually show colors, but when running them with op run , it seems like the color information is lost.
In this case, the script uses a javascript library...
1P_Simon
1Password Team
4 years agoThank you @r00t. It's exactly like you said.
For the masking feature, the CLI sits in-between stdout and stderr of the sub-process and the stdout and stderr of the op run
command to detect any secrets printed and conceal them. Because we pass the streams that we read from rather than the TTY directly, the auto-detection used in many CLIs for using color does not detect that you're in an interactive scenario (TTY) where color should be used.
I'm afraid there's not much we can do here for the op run
command to have both masking and auto-detection of colors by your sub-process.
I see two options you have:
1. Explicitly let the sub-process know you'd like to see colors. e.g. for chalk, you could use --color
or $FORCE_COLOR
as documented here: https://github.com/chalk/chalk#supportscolor
2. Disable masking for op run
using --no-masking
. In this case op run
doesn't sit between the sub-processes output and the TTY and the command running in the sub-process (chalk in your case) will be able to auto-detect the output is a TTY and use colors. With this option secrets printed to stdout and stderr will not be concealed by 1Password CLI.
Although a little unsatisfying that we cannot have the best of both worlds of auto-detection and masking, I hope this explanation will help you evaluate which of the two approaches to use.
How do you feel about the 1Password CLI defaulting to the masking in this trade-off?