Comments (2)
This occurs because the Go terminal.IsTerminal
function returns true
for PowerShell terminals (see implementation at https://go.googlesource.com/crypto/+/refs/heads/master/ssh/terminal/util_windows.go). Which is fair enough because the PowerShell console is a terminal, just not one that consistently supports VT100 sequences.
Looking at https://docs.microsoft.com/en-us/windows/console/getconsolemode, I think what we're really interested in is whether the current console mode includes the ENABLE_VIRTUAL_TERMINAL_PROCESSING
flag. Obviously Go doesn't surface this from its libraries, but we could try replacing the IsTerminal
call with a custom SupportsEscapeSequences
function which would return IsTerminal
on Unix but would additionally check the console mode on Windows. This gives a better user experience but is more invasive and risky (ripping out a stdlib function and replacing it with a custom one).
Alternatively, we could just turn colouring off entirely on Windows, i.e. the check for colouring would not be IsTerminal
but IsTerminal && IsUnix
.
Let me know your preference @corneliusweig - I have to admit I'm inclined to take the second option for now as it will be simpler and will still achieve the immediate goal of 'simple and well formatted.'
from rakkess.
Wow, thanks for your thorough investigation! You seem to be a PowerShell wizard :)
I had thoughts into the same direction, to completely turn off colors on windows. Alas, that would also turn off colors on terminals that do support colors, like the widespread git-shell. However, your idea opens up a far superior alternative. I think we should definitely try this one out -- this tool is not production critical, so it's a good test balloon. Other projects could benefit from this solution too, if it works reliably!
So let's try your idea about SupportsEscapeSequences
.
from rakkess.
Related Issues (20)
- Documentation does not match plugin capabilities HOT 1
- Add support for json output HOT 2
- Dependabot can't resolve your Go dependency files
- More powerful resource matching (ERRO[0005] determine requested resource: no matches for ...) HOT 2
- Dependabot can't resolve your Go dependency files
- Apple M1 Support HOT 1
- [FEAT] Comparison for different users or service accounts HOT 4
- Rakkess displays extra lines with no resource name and no permissons HOT 9
- inconsistency between access-matrix and "oc who-can"
- Missing assets for v0.5.1 HOT 1
- Krew is not able to install latest v0.5.1 version HOT 1
- What is "n/a" means in result matrix
- Support authorization based on `resourceNames`
- Add support for use verb HOT 4
- nothing is displayed for a service-account HOT 10
- Install failure via krew HOT 2
- Installation with Curl is failing "not in gzip format" HOT 2
- `rakkess version` is not printing version information HOT 1
- Rakkess gets very slow when latency goes up HOT 2
- 0.4.5 darwin archive is empty HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rakkess.