GithubHelp home page GithubHelp logo

Comments (6)

corneliusweig avatar corneliusweig commented on August 26, 2024 1

@itowlson Oh please do go ahead with the ascii formatting. I think yes/no is just fine. For now I like your idea to disable coloring in ascii mode. However, ideally we should turn it on again, if we can reliably detect a PowerShell terminal.

I've also opened another issue to track the coloring on PowerShell #6. Since I cannot investigate this, could you kindly look into this as well?

from rakkess.

corneliusweig avatar corneliusweig commented on August 26, 2024

You are raising two separate points.

  1. Color output. This is disabled for non-terminals, e.g. rakkess | cat or rakkess > result.txt do not produce colors. Also, PowerShell should (I can't check) not output colors, because this is determined at pkg/rakkess/util/printer.go:79 with

    func IsTerminal(fd int) bool {  
     _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
     return err == nil
    }
    

    PowerShell being not unix, should return false here.
    So I think color output is fine and does not need work (you can prove me wrong if you have a PowerShell :) )

  2. Ascii formatting. This is a good point. What do you think about a flag --ascii or --ascii-mode so that granted/denied is printed as yes/no or even granted/denied? pkg/rakkess/util/printer.go is where you would want to start.

from rakkess.

itowlson avatar itowlson commented on August 26, 2024

Good point - I am indeed mixing two things.

As you say, PowerShell does not support colour, but what I found was that rakkess still printed the escape codes - but they were rendered as codes and square brackets. I can retry tomorrow and post a screenshot if that would be useful. I think on Draft we gave up trying to be clever about this and just turned colours off on Windows!

Anyway you are right that these are two separate issues. I'd be interested in tackling ASCII output if you are okay with that. I suggest that ASCII formatting should automatically suppress colours, and I'd tentatively go with yes/no. Other ideas are granted/denied as you suggest, or allowed/denied. Let me know if you have a preference, otherwise I'll try to get you a PR and we can iterate on it there! And thanks for the pointer on the printer.go starting point.

from rakkess.

lgmorand avatar lgmorand commented on August 26, 2024

image
any idea what could cause encoding issues under WSL (Windows Linux Subsystem). that the first time, I have encoding issues with bash

from rakkess.

corneliusweig avatar corneliusweig commented on August 26, 2024

@lgmorand unfortunately no. IIUC, you are saying that other UTF encoded text prints correctly, right? If anyone knows, I bet @itowlson does.
Maybe open a separate issue so that other folks can find the bug.

from rakkess.

lgmorand avatar lgmorand commented on August 26, 2024

@corneliusweig exactly. it's def looks like an encoding issue but it seems a common, with not clear solution: microsoft/terminal#190

I don't use Windows Terminal but I don't believe in coincidences :)

from rakkess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.