-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improved logging for the cli with cli_spin
- Loading branch information
1 parent
701316d
commit 49274f1
Showing
22 changed files
with
539 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import 'package:impaktfull_cli/src/impaktfull_cli.dart'; | ||
|
||
Future<void> main(List<String> arguments) => ImpaktfullCli().runCli(arguments); | ||
Future<void> main(List<String> arguments) => ImpaktfullCli(arguments: arguments).runCli(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:path/path.dart'; | ||
|
||
class CliConstants { | ||
CliConstants._(); | ||
|
||
static final buildFolder = Directory(join('build', 'impaktfull_cli')); | ||
|
||
static String get buildFolderPath => buildFolder.path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 5 additions & 15 deletions
20
lib/src/core/model/error/impaktfull_cli_argument_error.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,11 @@ | ||
import 'package:args/args.dart'; | ||
import 'package:impaktfull_cli/src/core/model/error/impaktfull_cli_error.dart'; | ||
|
||
class ImpaktfullCliArgumentError extends ImpaktfullCliError { | ||
final String? command; | ||
final String usage; | ||
final ArgParser argParser; | ||
|
||
ImpaktfullCliArgumentError( | ||
super.message, | ||
this.command, | ||
this.usage, | ||
); | ||
|
||
@override | ||
String toString() => '''Error while parsing arguments for `$command`: | ||
$message | ||
Usage fo `$command`: | ||
$usage | ||
'''; | ||
super.message, { | ||
required this.argParser, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'package:impaktfull_cli/src/core/model/error/impaktfull_cli_error.dart'; | ||
|
||
class ImpktfullCliExitError extends ImpaktfullCliError { | ||
ImpktfullCliExitError(super.message); | ||
} |
10 changes: 10 additions & 0 deletions
10
lib/src/core/model/error/impaktfull_cli_process_runner_error.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:impaktfull_cli/src/core/model/error/impaktfull_cli_error.dart'; | ||
|
||
class ImpaktfullCliProcessRunnerError extends ImpaktfullCliError { | ||
final String errorOutput; | ||
|
||
ImpaktfullCliProcessRunnerError( | ||
super.message, | ||
this.errorOutput, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/src/core/util/input_listener/versbose_logging_listener.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'dart:async'; | ||
import 'dart:io'; | ||
|
||
import 'package:impaktfull_cli/src/core/util/logger/logger.dart'; | ||
|
||
class VerboseLoggingListener { | ||
static StreamSubscription<List<int>>? _subscription; | ||
|
||
VerboseLoggingListener._(); | ||
|
||
static void startInputListener() { | ||
_subscription = stdin.listen((data) { | ||
final input = String.fromCharCodes(data).trim(); | ||
|
||
if (input.toLowerCase() == 'v' || input.toLowerCase() == 'verbose') { | ||
ImpaktfullCliLogger.enableVerbose(isVerboseLoggingEnabled: true); | ||
} else if (input.toLowerCase() == 'nv' || input.toLowerCase() == 'no-verbose') { | ||
ImpaktfullCliLogger.enableVerbose(isVerboseLoggingEnabled: false); | ||
} | ||
}); | ||
} | ||
|
||
static void stopListening() => _subscription?.cancel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.