[PS] Is colorization possible/feasible with extensible format system?

Discussion in 'Scripting' started by Alex B Chalmers, May 17, 2006.

  1. I have been looking at various ways to colorize various outputs. My two
    favorite use cases here are the output of get-childitem and the various
    error output. I started using /\/\o\/\/'s ls replacement
    (http://mow001.blogspot.com/2006/01/colorized-msh-ls-replacement.html), and
    while not perfect, it handles filesystem provider output admirably.

    My problem with /\/\o\/\/'s solution here is that it breaks for alternate
    providers, such as variables. Additionally, this type of solution does not
    work well for error output as the error output is not user-called. I
    immediately thought of the extensible formatting system when trying to
    address the problem myself. To date, I've been unsuccessful at doing color
    in a custom format using CustomControl, though it could be that my
    understanding of the .format.ps1xml files is lacking.

    Ideally, I would like to be able to colorize FileInfo and DirectoryInfo
    based on a combination of the Attributes property (using the same basic
    logic as the Mode ScriptProperty) and file extension. As for the error
    output (ErrorRecord object), the only basic changes I would like to make is
    to add a blankline before the error text and to colorize it red (or any
    color that would assist in distinguishing it from other onscreen text).

    If this isn't possible in the V1 release, I hope this can get added to an
    already amazing product for V2.

    Thanks all for any suggestions here.

    - abc
     
    Alex B Chalmers, May 17, 2006
    #1
    1. Advertisements

  2. Hi Alex,
    Color support via format files is not available for V1. But it is
    definitely on the list of todos for V2.
     
    Abhishek Agrawal [MSFT], May 17, 2006
    #2
    1. Advertisements

  3. Hi Alex,
    did you check the NG thread that is metioned in the blog entry ?
    there is an Provider prove example and an XML coloring example mentioned
    also.

    I also provided some extra parameters cmd also has for filtering like
    -ad here :
    http://mow001.blogspot.com/2006/01/dir-dir-and-more-dir-in-msh.html

    I do think I made a combined one that does handle more providers also,
    but I can not find it, but the link to the NG Thread in my blog should
    get you going.



    Greetings /\/\o\/\/
     
    /\\/\\o\\/\\/, May 22, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.