Skip to content

Add an option to disable terminal control codes #72

@xxxserxxx

Description

@xxxserxxx

immortalctl always outputs terminal control codes. This makes using immortalctl in scripts difficult, as these codes have to be stripped out before parsing output and piping through other programs. Removing these codes would be ideal, as they are only cosmetic; however, having an option to disable these control codes would also work.

The way immortalctl uses the flags package is irregular, and makes it difficult to add actual flags to the program; the resulting code quickly becomes a mess of nested if-statements as the code has to work around mostly manual processing of command-line arguments (use of the flags API is superficial, at best).

I've started on a patch to add a switch to disable colored output; to do so idiomatically would require significant refactoring of the arguments parsing code, which constitutes a large portion of the code in immortalctl -- the resulting patch would be relatively large, compared to the size of main.go. Alternatively, I can wedge it into the existing code, but it results in significant added complexity to the arguments parsing.

Before I go much further on this, I'd like to get a sense of what would be an acceptable solution: (A) refactor to use the flags package more idiomatically, thereby cleaning up the code and making adding future flags easier, or (B) work the flag into the current argument parsing paradigm.

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