Skip to content

Only generate ANSI color codes if terminal supports it #221

@AliSoftware

Description

@AliSoftware

Now that #204 is ready to be merged and we can run SwiftGen in Xcode directly, I've realised that we output the ANSI color codes in the output even if the terminal doesn't support it. That's especially true when testing SwiftGen directly in Xcode 8 with #204 (and Xcode 8 not supporting plugins anymore, XcodeColors isn't available in Xcode 8)

Usage:

    $ /Users/ohalligon/Library/Developer/Xcode/DerivedData/SwiftGen-cxsyqpzjmmxarybjxtpndqpdtviv/Build/Products/Debug/swiftgen.app/Contents/MacOS/swiftgen

Commands:

    + �[32mtemplates�[0m - manage custom templates
    + �[32mcolors�[0m - generate code for UIColors
    + �[32mimages�[0m - generate code for UIImages based on your Assets Catalog
    + �[32mstoryboards�[0m - generate code for your Storyboard scenes and segues
    + �[32mstrings�[0m - generate code for your Localizable.strings
    + �[32mfonts�[0m - generate code for your UIFonts

That's probably linked to Commander — which is the one generating the usage output itself — but I'm not sure if we have to do something ourselves (like detecting if we're in a non-color-capable terminal or in Xcode's console, and set a property on Commander in our Swift code to ask not to use colors, or if it should be a Commander's PR on itself to auto-detect if the terminal supports color or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions