Skip to content

Commit

Permalink
CommandRegistry: added two static helper methods, #480
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 7, 2019
1 parent c36f878 commit e85af0e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions builtins/src/main/java/org/jline/builtins/CommandRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@

public interface CommandRegistry {

/**
* Aggregate SystemCompleters of commandRegisteries
* @return uncompiled SystemCompleter
*/
static Completers.SystemCompleter aggregateCompleters(CommandRegistry ... commandRegistries) {
Completers.SystemCompleter out = new Completers.SystemCompleter();
for (CommandRegistry r: commandRegistries) {
out.add(r.compileCompleters());
}
return out;
}

/**
* Aggregate and compile SystemCompleters of commandRegisteries
* @return compiled SystemCompleter
*/
static Completers.SystemCompleter compileCompleters(CommandRegistry ... commandRegistries) {
Completers.SystemCompleter out = aggregateCompleters(commandRegistries);
out.compile();
return out;
}

/**
* Returns the command names known by this registry.
* @return the set of known command names, excluding aliases
Expand Down

0 comments on commit e85af0e

Please sign in to comment.