Skip to content

Commit 8a55bc1

Browse files
committed
fix: format
1 parent 0f076a7 commit 8a55bc1

17 files changed

+652
-563
lines changed

lib/src/installer/completion_configuration.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import 'package:meta/meta.dart';
1010
///
1111
/// The map and its content are unmodifiable. This is to ensure that
1212
/// [CompletionConfiguration]s is fully immutable.
13-
typedef ShellCommandsMap
14-
= UnmodifiableMapView<SystemShell, UnmodifiableSetView<String>>;
13+
typedef ShellCommandsMap =
14+
UnmodifiableMapView<SystemShell, UnmodifiableSetView<String>>;
1515

1616
/// {@template completion_configuration}
1717
/// A configuration that stores information on how to handle command
@@ -28,8 +28,8 @@ class CompletionConfiguration {
2828
/// Creates an empty [CompletionConfiguration].
2929
@visibleForTesting
3030
CompletionConfiguration.empty()
31-
: uninstalls = ShellCommandsMap({}),
32-
installs = ShellCommandsMap({});
31+
: uninstalls = ShellCommandsMap({}),
32+
installs = ShellCommandsMap({});
3333

3434
/// Creates a [CompletionConfiguration] from the given [file] content.
3535
///

lib/src/installer/completion_installation.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ class CompletionInstallation {
139139
_logSourceInstructions(rootCommand);
140140
}
141141

142-
final completionConfiguration =
143-
CompletionConfiguration.fromFile(completionConfigurationFile);
142+
final completionConfiguration = CompletionConfiguration.fromFile(
143+
completionConfigurationFile,
144+
);
144145
completionConfiguration
145146
.copyWith(
146147
uninstalls: completionConfiguration.uninstalls.exclude(
@@ -305,7 +306,8 @@ class CompletionInstallation {
305306
_sourceScriptOnFile(
306307
configFile: shellRCFile,
307308
scriptName: 'Completion',
308-
description: 'Completion scripts setup. '
309+
description:
310+
'Completion scripts setup. '
309311
'Remove the following line to uninstall',
310312
scriptPath: path.join(
311313
completionConfigDir.path,
@@ -344,7 +346,8 @@ class CompletionInstallation {
344346

345347
description ??= 'Completion config for "$scriptName"';
346348

347-
final content = '''
349+
final content =
350+
'''
348351
## $description
349352
${configuration!.sourceLineTemplate(scriptPath)}''';
350353
ScriptConfigurationEntry(scriptName).appendTo(
@@ -429,14 +432,16 @@ ${configuration!.sourceLineTemplate(scriptPath)}''';
429432
completionEntry.removeFrom(shellRCFile);
430433
}
431434
final completionConfigDirContent = completionConfigDir.listSync();
432-
final onlyHasConfigurationFile = completionConfigDirContent.length == 1 &&
435+
final onlyHasConfigurationFile =
436+
completionConfigDirContent.length == 1 &&
433437
path.absolute(completionConfigDirContent.first.path) ==
434438
path.absolute(completionConfigurationFile.path);
435439
if (completionConfigDirContent.isEmpty || onlyHasConfigurationFile) {
436440
completionConfigDir.deleteSync(recursive: true);
437441
} else {
438-
final completionConfiguration =
439-
CompletionConfiguration.fromFile(completionConfigurationFile);
442+
final completionConfiguration = CompletionConfiguration.fromFile(
443+
completionConfigurationFile,
444+
);
440445
completionConfiguration
441446
.copyWith(
442447
uninstalls: completionConfiguration.uninstalls.include(

lib/src/installer/exceptions.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class CompletionInstallationException implements Exception {
1515
final String rootCommand;
1616

1717
@override
18-
String toString() => 'Could not install completion scripts for $rootCommand: '
18+
String toString() =>
19+
'Could not install completion scripts for $rootCommand: '
1920
'$message';
2021
}
2122

lib/src/installer/script_configuration_entry.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import 'dart:io';
77
class ScriptConfigurationEntry {
88
/// {@macro script_entry}
99
const ScriptConfigurationEntry(this.name)
10-
: _startComment = '## [$name]',
11-
_endComment = '## [/$name]';
10+
: _startComment = '## [$name]',
11+
_endComment = '## [/$name]';
1212

1313
/// The name of the entry.
1414
final String name;

lib/src/parser/arg_parser_extension.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ extension ArgParserExtension on ArgParser {
4646
});
4747

4848
try {
49-
return commandsOnlyGrammar
50-
.parse(filteredArgs.where((element) => element.isNotEmpty));
49+
return commandsOnlyGrammar.parse(
50+
filteredArgs.where((element) => element.isNotEmpty),
51+
);
5152
} on ArgParserException {
5253
return null;
5354
}

lib/src/parser/completion_level.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,18 @@ class CompletionLevel {
8585
// rawArgs should be only the args after the last parsed command
8686
final List<String> rawArgs;
8787
if (commandName != null) {
88-
rawArgs =
89-
rootArgs.skipWhile((value) => value != commandName).skip(1).toList();
88+
rawArgs = rootArgs
89+
.skipWhile((value) => value != commandName)
90+
.skip(1)
91+
.toList();
9092
} else {
9193
rawArgs = rootArgs.toList();
9294
}
9395

9496
final validOptionsResult = originalGrammar.findValidOptions(rawArgs);
9597

96-
final visibleSubcommands = subcommands?.values.where((command) {
98+
final visibleSubcommands =
99+
subcommands?.values.where((command) {
97100
return !command.hidden;
98101
}).toList() ??
99102
[];

lib/src/parser/completion_result.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,17 @@ class OptionValuesCompletionResult extends CompletionResult {
195195
required this.completionLevel,
196196
required this.optionName,
197197
this.pattern,
198-
}) : isAbbr = false,
199-
includeAbbrName = false;
198+
}) : isAbbr = false,
199+
includeAbbrName = false;
200200

201201
/// {@macro option_values_completion_result}
202202
const OptionValuesCompletionResult.abbr({
203203
required this.completionLevel,
204204
required String abbrName,
205205
this.pattern,
206206
this.includeAbbrName = false,
207-
}) : isAbbr = true,
208-
optionName = abbrName;
207+
}) : isAbbr = true,
208+
optionName = abbrName;
209209

210210
/// The [CompletionLevel] in which the suggested option is supposed to be
211211
/// located at.

lib/src/parser/parser.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ class CompletionParser {
6666
// option with "allowed" values
6767
// e.g. `my_cli --option valueNam|` or `my_cli -o valueNam|`
6868
if (nonEmptyArgs.length > 1) {
69-
final secondLastNonEmpty =
70-
nonEmptyArgs.elementAt(nonEmptyArgs.length - 2);
69+
final secondLastNonEmpty = nonEmptyArgs.elementAt(
70+
nonEmptyArgs.length - 2,
71+
);
7172

7273
final resultForValues = _getOptionValues(secondLastNonEmpty, argOnCursor);
7374

test/src/command_runner/commands/install_completion_files_command_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ void main() {
5050
await commandRunner.run(['install-completion-files']);
5151

5252
verify(
53-
() => commandRunner.completionInstallation
54-
.install(commandRunner.executableName, force: true),
53+
() => commandRunner.completionInstallation.install(
54+
commandRunner.executableName,
55+
force: true,
56+
),
5557
).called(1);
5658
});
5759

test/src/command_runner/commands/uninstall_completion_files_command_test.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ void main() {
5353
() => commandRunner.completionInstallationLogger.level = Level.info,
5454
).called(1);
5555
verify(
56-
() => commandRunner.completionInstallation
57-
.uninstall(commandRunner.executableName),
56+
() => commandRunner.completionInstallation.uninstall(
57+
commandRunner.executableName,
58+
),
5859
).called(1);
5960
});
6061

@@ -68,8 +69,9 @@ void main() {
6869
},
6970
).called(1);
7071
verify(
71-
() => commandRunner.completionInstallation
72-
.uninstall(commandRunner.executableName),
72+
() => commandRunner.completionInstallation.uninstall(
73+
commandRunner.executableName,
74+
),
7375
).called(1);
7476
});
7577
});

0 commit comments

Comments
 (0)