Skip to content

Commit

Permalink
Merge pull request #3 from liquibase/fix-hidden-commands
Browse files Browse the repository at this point in the history
Do not output hidden commands.
  • Loading branch information
mcred authored Aug 8, 2023
2 parents 2272491 + 1839ec7 commit 691f49a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/liquibase/command/GenerateProtobufCommandStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import liquibase.configuration.ConfigurationDefinition;
import liquibase.configuration.LiquibaseConfiguration;
import liquibase.exception.UnexpectedLiquibaseException;
import liquibase.util.StringUtil;

import java.io.BufferedWriter;
Expand Down Expand Up @@ -42,13 +43,17 @@ public void run(CommandResultsBuilder resultsBuilder) throws Exception {

writeGlobalToFile(outputDir);

if (targetCommand != "") {
writeCommandToFile(getCommand(targetCommand), outputDir);
if (StringUtil.isNotEmpty(targetCommand)) {
CommandDefinition command = getCommand(targetCommand);
if (command.getHidden()) {
throw new UnexpectedLiquibaseException("Command " + targetCommand + " cannot be generated as it is defined as a 'hidden' command by Liquibase");
}
writeCommandToFile(command, outputDir);
} else {
// Generate protobuf for all commands
for (CommandDefinition commandDefinition : getCommands()) {
//Don't generate protobuf for generateProtobuf command step
if (commandDefinition.getName() == COMMAND_NAME) {
//Don't generate protobuf for generateProtobuf command step or hidden commands
if (commandDefinition.getName() == COMMAND_NAME || commandDefinition.getHidden()) {
continue;
}
writeCommandToFile(commandDefinition, outputDir);
Expand Down

0 comments on commit 691f49a

Please sign in to comment.