-
-
Notifications
You must be signed in to change notification settings - Fork 55
Description
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.