Skip to content

Commit

Permalink
feat: add componentN for Kotlin destruct-assign
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 committed Mar 22, 2024
1 parent 7ff6f55 commit 00dbaf6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/cmdpipe.api
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public abstract interface class space/iseki/cmdpipe/Cmd$StreamProcessor {

public abstract interface class space/iseki/cmdpipe/Cmd$StreamProcessor$Ctx {
public abstract fun cmd ()Lspace/iseki/cmdpipe/Cmd;
public fun component1 ()Lspace/iseki/cmdpipe/Cmd;
public fun component2 ()Lspace/iseki/cmdpipe/Cmd$Stdio;
public fun component3 ()Ljava/lang/Object;
public fun getCmd ()Lspace/iseki/cmdpipe/Cmd;
public fun getStdio ()Lspace/iseki/cmdpipe/Cmd$Stdio;
public fun getStream ()Ljava/lang/Object;
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/space/iseki/cmdpipe/Cmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,33 @@ interface Ctx<T> {
default @NotNull T getStream() {
return stream();
}

/**
* Get the command.
*
* @return the command
*/
default @NotNull Cmd component1() {
return cmd();
}

/**
* Get the standard IO stream.
*
* @return the standard IO stream
*/
default @NotNull Stdio component2() {
return stdio();
}

/**
* Get the stream.
*
* @return the stream
*/
default @NotNull T component3() {
return stream();
}
}

@FunctionalInterface
Expand Down

0 comments on commit 00dbaf6

Please sign in to comment.