Search code examples
powershellpowershell-3.0ansi-escapepowershell-ise

Remove leading timestamp (minutes) from PowerShell ISE


I am using PowerShell ISE and when I get an error, this weird timestamp is leading the error message and this is starting to get annoying.

Command:

PS C:\Users\serhat> terraform plan -var="ENVIRONMENT=Test" -var="POSTFIX=test" -var="PROJECT=common"

Output:

terraform : [31mâ•·[0m[0m
At line:1 char:1
+ terraform plan -var="ENVIRONMENT=Test" -var="POSTFIX=test" -var="PROJ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: ([31mâ•·[0m[0m:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

[31m│[0m [0m[1m[31mError: [0m[0m[1mNo configuration files[0m
[31m│[0m [0m
[31m│[0m [0m[0mPlan requires configuration to be present. Planning without a configuration
[31m│[0m [0mwould mark everything for destruction, which is normally not what is
[31m│[0m [0mdesired. If you would like to destroy everything, run plan with the
[31m│[0m [0m-destroy option. Otherwise, create a Terraform configuration file (.tf
[31m│[0m [0mfile) and try again.
[31m╵[0m[0m

How do prevent this weird timestamp [31m│[0m [0m[1m[31m from appearing in all my ouputs?

PS: I am seeking for a permanent solution as I don't want to run a regex everytime I run a script.


Solution

  • To disable Terraform's colored output, pass the -no-color switch for a single command. One can also set up an environment variable TF_CLI_ARGS="-no-color" in case a global supression is needed.