Skip to content

Commit 2530788

Browse files
Matt Mullerkstich
authored andcommitted
Support include-prelude in smithy ast
1 parent 776f57c commit 2530788

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • smithy-cli/src/main/java/software/amazon/smithy/cli/commands

smithy-cli/src/main/java/software/amazon/smithy/cli/commands/AstCommand.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,26 @@ private static final class Options implements ArgumentReceiver {
5454
static final String FLATTEN_OPTION = "--flatten";
5555
private boolean flatten = false;
5656

57+
static final String INCLUDE_PRELUDE_OPTION = "--include-prelude";
58+
private boolean includePrelude = false;
59+
5760
@Override
5861
public boolean testOption(String name) {
5962
if (FLATTEN_OPTION.equals(name)) {
6063
flatten = true;
6164
return true;
6265
}
66+
if (INCLUDE_PRELUDE_OPTION.equals(name)) {
67+
includePrelude = true;
68+
return true;
69+
}
6370
return false;
6471
}
6572

6673
@Override
6774
public void registerHelp(HelpPrinter printer) {
6875
printer.option(FLATTEN_OPTION, null, "Flattens and removes mixins from the model.");
76+
printer.option(INCLUDE_PRELUDE_OPTION, null, "Includes the prelude shapes in the model.");
6977
}
7078
}
7179

@@ -80,8 +88,8 @@ private int runWithClassLoader(SmithyBuildConfig config, Arguments arguments, En
8088
.defaultSeverity(Severity.DANGER)
8189
.build();
8290

83-
ModelSerializer serializer = ModelSerializer.builder().build();
8491
Options options = arguments.getReceiver(Options.class);
92+
ModelSerializer serializer = ModelSerializer.builder().includePrelude(options.includePrelude).build();
8593
if (options.flatten) {
8694
model = ModelTransformer.create().flattenAndRemoveMixins(model);
8795
}

0 commit comments

Comments
 (0)