Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide log format parameter (DAT-13501) #3822

Merged
merged 1 commit into from Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1064,7 +1064,7 @@ private void addGlobalArguments(CommandLine commandLine) {
}

//only show the first/standard variation of a name
if (i > 0) {
if (i > 0 || def.isHidden()) {
optionBuilder.hidden(true);
}

Expand Down
Expand Up @@ -37,6 +37,7 @@ public class ConfigurationDefinition<DataType> implements Comparable<Configurati
private static final Pattern ALLOWED_KEY_PATTERN = Pattern.compile("[a-zA-Z0-9._]+");

private boolean loggedUsingDefault = false;
private boolean hidden = false;

/**
* Constructor private to force {@link Builder} usage
Expand Down Expand Up @@ -195,6 +196,13 @@ public boolean isInternal() {
return internal;
}

/**
* Return true if this configuration should not be printed to the console for any help command.
*/
public boolean isHidden() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be a temporary fix just for 4.19.1 ? If so maybe it could be tagged as deprecated or Beta so no one else uses it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I envisioned this a long term addition to the code. I could see it being useful elsewhere. There is also a isCommonlyUsed function, with corresponding setting, which ironically isn't used anywhere in the code. Presumably that method (at one time) had the same effect of hiding the property. Since I wasn't sure, I didn't do anything with that method.

return hidden;
}

@Override
public int compareTo(ConfigurationDefinition o) {
return this.getKey().compareTo(o.getKey());
Expand Down Expand Up @@ -326,6 +334,12 @@ public Building<DataType> setInternal(boolean internal) {
return this;
}

public Building<DataType> setHidden(boolean hidden) {
definition.hidden = hidden;

return this;
}

public Building<DataType> addAliases(Collection<String> aliases) {
for (String alias : aliases) {
if (!alias.contains(".")) {
Expand Down
Expand Up @@ -88,6 +88,7 @@ public class LiquibaseCommandLineConfiguration implements AutoloadedConfiguratio
"Open Source users default to unstructured \"" + LogFormat.TEXT + "\" logs to the console or output log files. " +
"Pro users have the option to set value as \"" + LogFormat.JSON + "\" or \"" + LogFormat.JSON_PRETTY + "\" to enable json-structured log files to the console or output log files.")
.setDefaultValue(LogFormat.TEXT)
.setHidden(true)
.setValueHandler((logFormat) -> {
if (logFormat == null) {
return null;
Expand Down