You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Unreleased
4
4
### Added
5
5
- Added `limit` parameter to `option().counted()` to limit the number of times the option can be used. You can either clamp the value to the limit, or throw an error if the limit is exceeded. ([#483](https://github.com/ajalt/clikt/issues/483))
6
+
- Added `Context.registerClosable` and `Context.callOnClose` to allow you to register cleanup actions that will be called when the command exits. ([#395](https://github.com/ajalt/clikt/issues/395))
Copy file name to clipboardExpand all lines: clikt/api/clikt.api
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -161,6 +161,8 @@ public final class com/github/ajalt/clikt/core/Context {
161
161
public static final field Companion Lcom/github/ajalt/clikt/core/Context$Companion;
162
162
public synthetic fun <init> (Lcom/github/ajalt/clikt/core/Context;Lcom/github/ajalt/clikt/core/CliktCommand;ZZLjava/lang/String;ZLjava/util/Set;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Lcom/github/ajalt/mordant/terminal/Terminal;Lkotlin/jvm/functions/Function1;ZLcom/github/ajalt/clikt/sources/ValueSource;Lkotlin/jvm/functions/Function2;Lcom/github/ajalt/clikt/output/Localization;Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
163
163
public final fun ancestors ()Lkotlin/sequences/Sequence;
164
+
public final fun callOnClose (Lkotlin/jvm/functions/Function0;)V
165
+
public final fun close ()V
164
166
public final fun commandNameWithParents ()Ljava/util/List;
165
167
public final fun fail (Ljava/lang/String;)Ljava/lang/Void;
166
168
public static synthetic fun fail$default (Lcom/github/ajalt/clikt/core/Context;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/Void;
@@ -239,8 +241,13 @@ public abstract interface class com/github/ajalt/clikt/core/ContextCliktError {
239
241
public abstract fun setContext (Lcom/github/ajalt/clikt/core/Context;)V
240
242
}
241
243
244
+
public final class com/github/ajalt/clikt/core/ContextJvmKt {
245
+
public static final fun registerJvmCloseable (Lcom/github/ajalt/clikt/core/Context;Ljava/lang/AutoCloseable;)Ljava/lang/AutoCloseable;
246
+
}
247
+
242
248
public final class com/github/ajalt/clikt/core/ContextKt {
243
249
public static final fun getTheme (Lcom/github/ajalt/clikt/core/Context;)Lcom/github/ajalt/mordant/rendering/Theme;
250
+
public static final fun registerCloseable (Lcom/github/ajalt/clikt/core/Context;Ljava/lang/AutoCloseable;)Ljava/lang/AutoCloseable;
244
251
}
245
252
246
253
public final class com/github/ajalt/clikt/core/FileNotFound : com/github/ajalt/clikt/core/UsageError {
0 commit comments