File tree Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.1.0
2
+ - Add missing exports
3
+ - Change ` ask ` return type for an generic to allow nullable value
4
+
1
5
## 2.0.0
2
6
- Rework the whole library
3
7
- Change ` input ` to ` ask ` component
Original file line number Diff line number Diff line change @@ -4,4 +4,12 @@ export 'package:commander_ui/src/application/utils/terminal_tools.dart';
4
4
export 'package:commander_ui/src/domains/models/commander_theme.dart' ;
5
5
export 'package:commander_ui/src/domains/models/component.dart' ;
6
6
7
+ export 'package:commander_ui/src/application/components/select.dart' ;
8
+ export 'package:commander_ui/src/application/components/ask.dart' ;
9
+ export 'package:commander_ui/src/application/components/checkbox.dart' ;
10
+ export 'package:commander_ui/src/application/components/screen.dart' ;
11
+ export 'package:commander_ui/src/application/components/swap.dart' ;
12
+ export 'package:commander_ui/src/application/components/table.dart' ;
13
+ export 'package:commander_ui/src/application/components/task.dart' ;
14
+
7
15
export 'package:mansion/mansion.dart' ;
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ import 'package:commander_ui/src/domains/models/component.dart';
7
7
import 'package:mansion/mansion.dart' ;
8
8
9
9
/// A component that asks the user for input.
10
- final class Ask with TerminalTools implements Component <Future <String ? >> {
11
- final _completer = Completer <String ? >();
10
+ final class Ask < T > with TerminalTools implements Component <Future <T >> {
11
+ final _completer = Completer <T >();
12
12
13
13
final Terminal _terminal;
14
14
@@ -43,7 +43,7 @@ final class Ask with TerminalTools implements Component<Future<String?>> {
43
43
}
44
44
45
45
@override
46
- Future <String ? > handle () {
46
+ Future <T > handle () {
47
47
saveCursorPosition ();
48
48
49
49
createSpace (_terminal, 1 );
@@ -152,7 +152,7 @@ final class Ask with TerminalTools implements Component<Future<String?>> {
152
152
resetCursor ();
153
153
stdout.write (buffer.toString ());
154
154
155
- _completer.complete (response);
155
+ _completer.complete (response as T );
156
156
}
157
157
158
158
void resetCursor () {
Original file line number Diff line number Diff line change @@ -60,11 +60,11 @@ class Commander with TerminalTools {
60
60
void debug (String ? message, {StdoutStyle ? style}) =>
61
61
writeln ((style ?? _theme.debug)(message));
62
62
63
- Future <String ? > ask (String message,
63
+ Future <T > ask < T > (String message,
64
64
{String ? defaultValue,
65
65
bool hidden = false ,
66
66
String ? Function (String )? validate}) =>
67
- Ask (_terminal,
67
+ Ask < T > (_terminal,
68
68
message: message,
69
69
defaultValue: defaultValue,
70
70
hidden: hidden,
Original file line number Diff line number Diff line change 1
1
name : commander_ui
2
2
description : Commander is a Dart library for creating user interfaces within the terminal.
3
- version : 2.0 .0
3
+ version : 2.1 .0
4
4
repository : https://github.com/LeadcodeDev/commander
5
5
6
6
topics :
You can’t perform that action at this time.
0 commit comments