diff --git a/lib/commands/app/info.dart b/lib/commands/app/info.dart index 699de24..b3071f0 100644 --- a/lib/commands/app/info.dart +++ b/lib/commands/app/info.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -43,10 +42,10 @@ final class AppInfoCommand extends Command { switch (response["apps"]) { case final List list: - stdout.writeln(listToAsciiTable(list, _keysIgnore)); + context.printer.writeln(listToAsciiTable(list, _keysIgnore)); break; case final Map data: - stdout.writeln(mapToVerticalAsciiTable(data, _keysIgnore)); + context.printer.writeln(mapToVerticalAsciiTable(data, _keysIgnore)); break; } } diff --git a/lib/commands/app/status.dart b/lib/commands/app/status.dart index b854115..c9d02d9 100644 --- a/lib/commands/app/status.dart +++ b/lib/commands/app/status.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -30,7 +29,7 @@ final class AppStatusCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["apps"] case final data?) { - stdout.writeln(mapToVerticalAsciiTable(data, _keysToIgnore)); + context.printer.writeln(mapToVerticalAsciiTable(data, _keysToIgnore)); } } } diff --git a/lib/commands/domain/create.dart b/lib/commands/domain/create.dart index 798d186..5271711 100644 --- a/lib/commands/domain/create.dart +++ b/lib/commands/domain/create.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -33,6 +32,6 @@ final class CustomdomainCreateCommand extends Command { spinner.success(resolveResponseMessage(response)); - stdout.writeln(mapToVerticalAsciiTable(response["domain"])); + context.printer.writeln(mapToVerticalAsciiTable(response["domain"])); } } diff --git a/lib/commands/domain/info.dart b/lib/commands/domain/info.dart index a8cb58b..d16fcd4 100644 --- a/lib/commands/domain/info.dart +++ b/lib/commands/domain/info.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -29,10 +28,10 @@ final class CustomdomainInfoCommand extends Command { switch (response["domain"] ?? response["domains"]) { case final List list: - stdout.writeln(listToAsciiTable(list)); + context.printer.writeln(listToAsciiTable(list)); break; case final Map data: - stdout.writeln(mapToVerticalAsciiTable(data)); + context.printer.writeln(mapToVerticalAsciiTable(data)); break; } } diff --git a/lib/commands/domain/verify.dart b/lib/commands/domain/verify.dart index c6fda73..bbf6b4e 100644 --- a/lib/commands/domain/verify.dart +++ b/lib/commands/domain/verify.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -27,6 +26,6 @@ final class CustomdomainVerifyCommand extends Command { spinner.success(resolveResponseMessage(response)); - stdout.writeln(mapToVerticalAsciiTable(response["domain"])); + context.printer.writeln(mapToVerticalAsciiTable(response["domain"])); } } diff --git a/lib/commands/snapshot/create.dart b/lib/commands/snapshot/create.dart index fbccf02..90ac069 100644 --- a/lib/commands/snapshot/create.dart +++ b/lib/commands/snapshot/create.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -28,11 +27,11 @@ final class SnapshotCreateCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["snapshot"] case final Map snapshot) { - stdout.writeln(mapToVerticalAsciiTable(_flattenSnapshot(snapshot))); + context.printer.writeln(mapToVerticalAsciiTable(_flatten(snapshot))); } } - Map _flattenSnapshot(Map snapshot) { + Map _flatten(Map snapshot) { return {"Version": snapshot["version"], "Size": snapshot["version"]}; } } diff --git a/lib/commands/snapshot/info.dart b/lib/commands/snapshot/info.dart index 5a63c66..1799e00 100644 --- a/lib/commands/snapshot/info.dart +++ b/lib/commands/snapshot/info.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -55,7 +54,7 @@ final class SnapshotInfoCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["versions"] case final List list) { - stdout.writeln(listToAsciiTable(_flattenSnapshotVersion(list))); + context.printer.writeln(listToAsciiTable(_flattenSnapshotVersion(list))); } } @@ -74,9 +73,9 @@ final class SnapshotInfoCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["apps"] case final List list) { - stdout.writeln(listToAsciiTable(_flattenSnapshotApp(list))); + context.printer.writeln(listToAsciiTable(_flattenSnapshotApp(list))); if (response["pagination"] case final Map pagination) { - stdout.writeln(_showSnapshotPagination(pagination)); + context.printer.writeln(_showSnapshotPagination(pagination)); } } } diff --git a/lib/commands/subdomain/create.dart b/lib/commands/subdomain/create.dart index 88d0416..a0a3260 100644 --- a/lib/commands/subdomain/create.dart +++ b/lib/commands/subdomain/create.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -27,6 +26,6 @@ final class SubdomainCreateCommand extends Command { spinner.success(resolveResponseMessage(response)); - stdout.writeln(mapToVerticalAsciiTable(response["subdomain"])); + context.printer.writeln(mapToVerticalAsciiTable(response["subdomain"])); } } diff --git a/lib/commands/subdomain/info.dart b/lib/commands/subdomain/info.dart index 7521e2c..d4e76fe 100644 --- a/lib/commands/subdomain/info.dart +++ b/lib/commands/subdomain/info.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -29,10 +28,10 @@ final class SubdomainInfoCommand extends Command { switch (response["subdomain"] ?? response["subdomains"]) { case final List list: - stdout.writeln(listToAsciiTable(list)); + context.printer.writeln(listToAsciiTable(list)); break; case final Map data: - stdout.writeln(mapToVerticalAsciiTable(data)); + context.printer.writeln(mapToVerticalAsciiTable(data)); break; } } diff --git a/lib/commands/team/status.dart b/lib/commands/team/status.dart index 9449601..f8efcd4 100644 --- a/lib/commands/team/status.dart +++ b/lib/commands/team/status.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -30,7 +29,7 @@ final class TeamStatusCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["apps"] case final data?) { - stdout.writeln(mapToVerticalAsciiTable(data, _keysToIgnore)); + context.printer.writeln(mapToVerticalAsciiTable(data, _keysToIgnore)); } } } diff --git a/lib/commands/user/info.dart b/lib/commands/user/info.dart index 2144b90..50c4e73 100644 --- a/lib/commands/user/info.dart +++ b/lib/commands/user/info.dart @@ -1,5 +1,4 @@ import "dart:async"; -import "dart:io"; import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; @@ -23,7 +22,7 @@ final class UserInfoCommand extends Command { spinner.success(resolveResponseMessage(response)); if (response["user"] case final Map data) { - stdout.writeln(mapToVerticalAsciiTable(data, _keysIgnore)); + context.printer.writeln(mapToVerticalAsciiTable(data, _keysIgnore)); } } } diff --git a/lib/commands/wait.dart b/lib/commands/wait.dart index dac6c4e..695ac38 100644 --- a/lib/commands/wait.dart +++ b/lib/commands/wait.dart @@ -17,12 +17,9 @@ final class WaitCommand extends Command with Disposable { @override final hidden = true; - @override - final takesArguments = true; - @override Future run() async { - if (argResults?.arguments.firstOrNull case final seconds?) { + if (argResults?.rest.firstOrNull case final seconds?) { if (int.tryParse(seconds) case final seconds? when seconds.isPositive) { await Future.delayed(.new(seconds: seconds)); }