Skip to content

Commit

Permalink
Initialize color as empty
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatrivedi committed Mar 4, 2016
1 parent e656893 commit 8e1de56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/sleekbyte/tailor/common/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ public class Messages {
public static final String ERRORS_KEY = "errors";
public static final String WARNINGS_KEY = "warnings";

// CLI options
// Error messags
public static final String NO_SWIFT_FILES_FOUND = "No Swift source files were found.";
public static final String COULD_NOT_BE_PARSED = " could not be parsed successfully, skipping...";

// CLI options
public static final String SYNTAX_PREFIX = "Usage: ";
public static final String OPTIONS_PREFIX = "Options:";
public static final int HELP_WIDTH = 99;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class YamlConfiguration {
private Set<String> except = new HashSet<>();
private String format = "";
private boolean debug = false;
private String color = null;
private String color = "";

public String getFormat() {
return format;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/sleekbyte/tailor/utils/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public boolean shouldListFiles() {
*/
public boolean shouldColorOutput() {
boolean shouldColorOutput = cliArgumentParser.shouldColorOutput();
if (shouldColorOutput && yamlConfiguration.isPresent() && yamlConfiguration.get().getColor() != null) {
if (shouldColorOutput
&& yamlConfiguration.isPresent()
&& !yamlConfiguration.get().getColor().isEmpty()) {
String option = yamlConfiguration.get().getColor();
validateColorOption(option);
if (option.equals(Messages.DISABLE)) {
Expand All @@ -82,7 +84,9 @@ public boolean shouldColorOutput() {
*/
public boolean shouldInvertColorOutput() {
boolean shouldInvertColorOutput = cliArgumentParser.shouldInvertColorOutput();
if (!shouldInvertColorOutput && yamlConfiguration.isPresent() && yamlConfiguration.get().getColor() != null) {
if (!shouldInvertColorOutput
&& yamlConfiguration.isPresent()
&& !yamlConfiguration.get().getColor().isEmpty()) {
String option = yamlConfiguration.get().getColor();
validateColorOption(option);
if (option.equals(Messages.INVERT)) {
Expand Down

0 comments on commit 8e1de56

Please sign in to comment.