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+
15## 2.0.0
26- Rework the whole library
37- 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';
44export 'package:commander_ui/src/domains/models/commander_theme.dart' ;
55export 'package:commander_ui/src/domains/models/component.dart' ;
66
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+
715export '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';
77import 'package:mansion/mansion.dart' ;
88
99/// 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 >();
1212
1313 final Terminal _terminal;
1414
@@ -43,7 +43,7 @@ final class Ask with TerminalTools implements Component<Future<String?>> {
4343 }
4444
4545 @override
46- Future <String ? > handle () {
46+ Future <T > handle () {
4747 saveCursorPosition ();
4848
4949 createSpace (_terminal, 1 );
@@ -152,7 +152,7 @@ final class Ask with TerminalTools implements Component<Future<String?>> {
152152 resetCursor ();
153153 stdout.write (buffer.toString ());
154154
155- _completer.complete (response);
155+ _completer.complete (response as T );
156156 }
157157
158158 void resetCursor () {
Original file line number Diff line number Diff line change @@ -60,11 +60,11 @@ class Commander with TerminalTools {
6060 void debug (String ? message, {StdoutStyle ? style}) =>
6161 writeln ((style ?? _theme.debug)(message));
6262
63- Future <String ? > ask (String message,
63+ Future <T > ask < T > (String message,
6464 {String ? defaultValue,
6565 bool hidden = false ,
6666 String ? Function (String )? validate}) =>
67- Ask (_terminal,
67+ Ask < T > (_terminal,
6868 message: message,
6969 defaultValue: defaultValue,
7070 hidden: hidden,
Original file line number Diff line number Diff line change 11name : commander_ui
22description : Commander is a Dart library for creating user interfaces within the terminal.
3- version : 2.0 .0
3+ version : 2.1 .0
44repository : https://github.com/LeadcodeDev/commander
55
66topics :
You can’t perform that action at this time.
0 commit comments