Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,258 changes: 1,258 additions & 0 deletions DEMO.md

Large diffs are not rendered by default.

837 changes: 811 additions & 26 deletions README.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,28 @@ dependencies {

// Logging
implementation 'org.slf4j:slf4j-api:2.0.9'

// Testing
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testImplementation 'org.mockito:mockito-core:5.8.0'
testImplementation files('../flexo-cli-client/build/libs/flexo-cli-client-0.1.0.jar')
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

test {
useJUnitPlatform()
maxParallelForks = 1
forkEvery = 1

// Disable parallel test execution within JUnit
systemProperty 'junit.jupiter.execution.parallel.enabled', 'false'
}

jar {
archiveBaseName = 'flexo-cli-sysmlv2-plugin'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ public void initialize(PluginContext context) {
public CommandSpec getCommand() {
SysMLCommand cmd = new SysMLCommand();
cmd.setContext(context);
return CommandSpec.forAnnotatedObject(cmd);
CommandSpec spec = CommandSpec.forAnnotatedObject(cmd);

// Propagate context to all subcommands
propagateContextToSubcommands(spec);

return spec;
}

private void propagateContextToSubcommands(CommandSpec spec) {
for (picocli.CommandLine subcommandLine : spec.subcommands().values()) {
CommandSpec subcommand = subcommandLine.getCommandSpec();
Object userObject = subcommand.userObject();
if (userObject instanceof org.openmbee.flexo.cli.plugin.PluginCommand) {
((org.openmbee.flexo.cli.plugin.PluginCommand) userObject).setContext(context);
}
// Recursively propagate to nested subcommands
propagateContextToSubcommands(subcommand);
}
}
}
Loading