Skip to content

Commit

Permalink
add quiet to merged code
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmclean committed Jan 14, 2025
1 parent e6988bb commit c48e92e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class FilesetCommandHandler extends CommandHandler {
private final String catalog;
private final String schema;
private String fileset;
private final boolean quiet;

/**
* Constructs a {@link FilesetCommandHandler} instance.
Expand All @@ -46,13 +47,19 @@ public class FilesetCommandHandler extends CommandHandler {
* @param line The command line arguments.
* @param command The command to execute.
* @param ignore Ignore server version mismatch.
* @param quiet Suppress output.
*/
public FilesetCommandHandler(
GravitinoCommandLine gravitinoCommandLine, CommandLine line, String command, boolean ignore) {
GravitinoCommandLine gravitinoCommandLine,
CommandLine line,
String command,
boolean ignore,
boolean quiet) {
this.gravitinoCommandLine = gravitinoCommandLine;
this.line = line;
this.command = command;
this.ignore = ignore;
this.quiet = quiet;

this.url = gravitinoCommandLine.getUrl();
this.name = new FullName(line);
Expand Down Expand Up @@ -141,7 +148,8 @@ private void handleCreateCommand() {
String[] properties = line.getOptionValues(CommandActions.PROPERTIES);
Map<String, String> propertyMap = new Properties().parse(properties);
gravitinoCommandLine
.newCreateFileset(url, ignore, metalake, catalog, schema, fileset, comment, propertyMap)
.newCreateFileset(
url, ignore, quiet, metalake, catalog, schema, fileset, comment, propertyMap)
.validate()
.handle();
}
Expand All @@ -150,7 +158,7 @@ private void handleCreateCommand() {
private void handleDeleteCommand() {
boolean force = line.hasOption(GravitinoOptions.FORCE);
gravitinoCommandLine
.newDeleteFileset(url, ignore, force, metalake, catalog, schema, fileset)
.newDeleteFileset(url, ignore, quiet, force, metalake, catalog, schema, fileset)
.validate()
.handle();
}
Expand All @@ -160,7 +168,8 @@ private void handleSetCommand() {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
String value = line.getOptionValue(GravitinoOptions.VALUE);
gravitinoCommandLine
.newSetFilesetProperty(url, ignore, metalake, catalog, schema, fileset, property, value)
.newSetFilesetProperty(
url, ignore, quiet, metalake, catalog, schema, fileset, property, value)
.validate()
.handle();
}
Expand All @@ -169,7 +178,7 @@ private void handleSetCommand() {
private void handleRemoveCommand() {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
gravitinoCommandLine
.newRemoveFilesetProperty(url, ignore, metalake, catalog, schema, fileset, property)
.newRemoveFilesetProperty(url, ignore, quiet, metalake, catalog, schema, fileset, property)
.validate()
.handle();
}
Expand All @@ -195,14 +204,14 @@ private void handleUpdateCommand() {
if (line.hasOption(GravitinoOptions.COMMENT)) {
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
gravitinoCommandLine
.newUpdateFilesetComment(url, ignore, metalake, catalog, schema, fileset, comment)
.newUpdateFilesetComment(url, ignore, quiet, metalake, catalog, schema, fileset, comment)
.validate()
.handle();
}
if (line.hasOption(GravitinoOptions.RENAME)) {
String newName = line.getOptionValue(GravitinoOptions.RENAME);
gravitinoCommandLine
.newUpdateFilesetName(url, ignore, metalake, catalog, schema, fileset, newName)
.newUpdateFilesetName(url, ignore, quiet, metalake, catalog, schema, fileset, newName)
.validate()
.handle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ private void executeCommand() {
} else if (entity.equals(CommandEntities.CATALOG)) {
new CatalogCommandHandler(this, line, command, ignore, quiet).handle();
} else if (entity.equals(CommandEntities.METALAKE)) {
new MetalakeCommandHandler(this, line, command, ignore).handle();
new MetalakeCommandHandler(this, line, command, ignore, quiet).handle();
} else if (entity.equals(CommandEntities.TOPIC)) {
new TopicCommandHandler(this, line, command, ignore, quiet).handle();
} else if (entity.equals(CommandEntities.FILESET)) {
new FilesetCommandHandler(this, line, command, ignore).handle();
new FilesetCommandHandler(this, line, command, ignore, quiet).handle();
} else if (entity.equals(CommandEntities.USER)) {
new UserCommandHandler(this, line, command, ignore, quiet).handle();
} else if (entity.equals(CommandEntities.GROUP)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class MetalakeCommandHandler extends CommandHandler {
private final boolean ignore;
private final String url;
private String metalake;
private final boolean quiet;

/**
* Constructs a MetalakeCommandHandler instance.
Expand All @@ -41,13 +42,19 @@ public class MetalakeCommandHandler extends CommandHandler {
* @param line The command line arguments.
* @param command The command to execute.
* @param ignore Ignore server version mismatch.
* @param quiet Suppress output.
*/
public MetalakeCommandHandler(
GravitinoCommandLine gravitinoCommandLine, CommandLine line, String command, boolean ignore) {
GravitinoCommandLine gravitinoCommandLine,
CommandLine line,
String command,
boolean ignore,
boolean quiet) {
this.gravitinoCommandLine = gravitinoCommandLine;
this.line = line;
this.command = command;
this.ignore = ignore;
this.quiet = quiet;
this.url = getUrl(line);
}

Expand Down Expand Up @@ -132,21 +139,24 @@ private void handleDetailsCommand() {
/** Handles the "CREATE" command. */
private void handleCreateCommand() {
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
gravitinoCommandLine.newCreateMetalake(url, ignore, metalake, comment).validate().handle();
gravitinoCommandLine
.newCreateMetalake(url, ignore, quiet, metalake, comment)
.validate()
.handle();
}

/** Handles the "DELETE" command. */
private void handleDeleteCommand() {
boolean force = line.hasOption(GravitinoOptions.FORCE);
gravitinoCommandLine.newDeleteMetalake(url, ignore, force, metalake).validate().handle();
gravitinoCommandLine.newDeleteMetalake(url, ignore, quiet, force, metalake).validate().handle();
}

/** Handles the "SET" command. */
private void handleSetCommand() {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
String value = line.getOptionValue(GravitinoOptions.VALUE);
gravitinoCommandLine
.newSetMetalakeProperty(url, ignore, metalake, property, value)
.newSetMetalakeProperty(url, ignore, quiet, metalake, property, value)
.validate()
.handle();
}
Expand All @@ -155,7 +165,7 @@ private void handleSetCommand() {
private void handleRemoveCommand() {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
gravitinoCommandLine
.newRemoveMetalakeProperty(url, ignore, metalake, property)
.newRemoveMetalakeProperty(url, ignore, quiet, metalake, property)
.validate()
.handle();
}
Expand All @@ -174,26 +184,26 @@ private void handleUpdateCommand() {
if (line.hasOption(GravitinoOptions.ENABLE)) {
boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
gravitinoCommandLine
.newMetalakeEnable(url, ignore, metalake, enableAllCatalogs)
.newMetalakeEnable(url, ignore, quiet, metalake, enableAllCatalogs)
.validate()
.handle();
}
if (line.hasOption(GravitinoOptions.DISABLE)) {
gravitinoCommandLine.newMetalakeDisable(url, ignore, metalake).validate().handle();
gravitinoCommandLine.newMetalakeDisable(url, ignore, quiet, metalake).validate().handle();
}

if (line.hasOption(GravitinoOptions.COMMENT)) {
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
gravitinoCommandLine
.newUpdateMetalakeComment(url, ignore, metalake, comment)
.newUpdateMetalakeComment(url, ignore, quiet, metalake, comment)
.validate()
.handle();
}
if (line.hasOption(GravitinoOptions.RENAME)) {
String newName = line.getOptionValue(GravitinoOptions.RENAME);
boolean force = line.hasOption(GravitinoOptions.FORCE);
gravitinoCommandLine
.newUpdateMetalakeName(url, ignore, force, metalake, newName)
.newUpdateMetalakeName(url, ignore, quiet, force, metalake, newName)
.validate()
.handle();
}
Expand Down

0 comments on commit c48e92e

Please sign in to comment.