[ https://issues.apache.org/jira/browse/MSHARED-687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378466#comment-16378466 ]
Hervé Boutemy commented on MSHARED-687: --------------------------------------- IMHO, refactoring is not necessary (and I fear it would make code complex): if color is not enabled, reading their definition does not have any meaning. Please make a test in a branch: IMHO, it will be easier than long discussions > Programmatic read-only access to Color API > ------------------------------------------ > > Key: MSHARED-687 > URL: https://issues.apache.org/jira/browse/MSHARED-687 > Project: Maven Shared Components > Issue Type: Improvement > Components: maven-shared-utils > Affects Versions: maven-shared-utils-3.2.1 > Reporter: Guillaume Boué > Assignee: Guillaume Boué > Priority: Minor > > We should provide a way to access programmatically the Color API, without > being JAnsi specific. Read-only should suffice for now, as the styles can be > changed through system properties. This would allow tools, like the Help > Plugin, to interact with it without depending on the implementation. > - Refactor JAnsi specific code currently in {{Style}} into > {{AnsiMessageBuilder}}. > - Make {{Style}} part of public API, and add getters {{boolean isBold()}}, > {{boolean isBright()}}, {{String getColor()}}, {{boolean isBgBright()}} and > {{String getBgColor()}}. > - Document {{Style.toString()}} to return a comma-separated list of the > style components (e.g. {{bold,red}}). > - Add a public {{List<String> getAvailableColorNames()}} method to > {{MessageUtils}}. Today, it would return the list of color names in the enum > {{Ansi.Color}} if JAnsi is present, otherwise an empty list. > With those changes, a consumer could for example do: > {code:java} > MessageUtils.buffer().success( Style.SUCCESS.toString() ) > {code} > in order to print the String representation of success with its own style, > while not depending on JAnsi. -- This message was sent by Atlassian JIRA (v7.6.3#76005)