Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo #122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/commands/commands_list.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'impl/commads_export.dart';
import 'impl/commands_export.dart';
import 'interface/command.dart';

final List<Command> commands = [
Expand Down Expand Up @@ -31,13 +31,13 @@ final List<Command> commands = [
class CommandParent extends Command {
final String _name;
final List<String> _alias;
final List<Command> _childrens;
CommandParent(this._name, this._childrens, [this._alias = const []]);
final List<Command> _children;
CommandParent(this._name, this._children, [this._alias = const []]);

@override
String get commandName => _name;
@override
List<Command> get childrens => _childrens;
List<Command> get children => _children;
@override
List<String> get alias => _alias;

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/args_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mixin ArgsMixin {
return '';
}

/// return [true] if conatains flags
/// return [true] if contains flags
///
/// example run
/// `get sort . --skipRename`
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/create/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CreateControllerCommand extends Command {
String? get hint => LocaleKeys.hint_create_controller.tr;

@override
String get codeSample => 'get create controller:name [OPTINAL PARAMETERS] \n'
String get codeSample => 'get create controller:name [OPTIONAL PARAMETERS] \n'
'${LocaleKeys.optional_parameters.trArgs(['[on, with]'])} ';
@override
bool validate() {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/create/page/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CreatePageCommand extends Command {
Structure.pathToDirImport(viewFile.path),
);
LogService.success(
LocaleKeys.sucess_page_create.trArgs([name.pascalCase]));
LocaleKeys.success_page_create.trArgs([name.pascalCase]));
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/create/project/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:recase/recase.dart';

import '../../../../common/utils/logger/log_utils.dart';
import '../../../../common/utils/pubspec/pubspec_utils.dart';
import '../../../../common/utils/shell/shel.utils.dart';
import '../../../../common/utils/shell/shell.utils.dart';
import '../../../../core/internationalization.dart';
import '../../../../core/locales.g.dart';
import '../../../../core/structure.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/generate/locales/locales.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class GenerateLocalesCommand extends Command {
path: '${_fileModel.path}.g.dart')
.create();

LogService.success(LocaleKeys.sucess_locale_generate.tr);
LogService.success(LocaleKeys.success_locale_generate.tr);
}

void _resolve(Map<String, dynamic> localization, Map<String, String?> result,
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/help/help.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $commandsHelp
var result = '';
for (var command in commands) {
result += '\n ${' ' * index} ${command.commandName}: ${command.hint}';
result += _getCommandsHelp(command.childrens, index + 1);
result += _getCommandsHelp(command.children, index + 1);
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/init/flutter/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:cli_menu/cli_menu.dart';

import '../../../../common/utils/logger/log_utils.dart';
import '../../../../common/utils/pubspec/pubspec_utils.dart';
import '../../../../common/utils/shell/shel.utils.dart';
import '../../../../common/utils/shell/shell.utils.dart';
import '../../../../core/internationalization.dart';
import '../../../../core/locales.g.dart';
import '../../../interface/command.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/impl/init/flutter/init_getxpattern.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../../../../core/structure.dart';
import '../../../../functions/create/create_list_directory.dart';
import '../../../../functions/create/create_main.dart';
import '../../../../samples/impl/getx_pattern/get_main.dart';
import '../../commads_export.dart';
import '../../commands_export.dart';
import '../../install/install_get.dart';

Future<void> createInitGetxPattern() async {
Expand All @@ -28,5 +28,5 @@ Future<void> createInitGetxPattern() async {
]);
createListDirectory(initialDirs);

LogService.success(Translation(LocaleKeys.sucess_getx_pattern_generated));
LogService.success(Translation(LocaleKeys.success_getx_pattern_generated));
}
5 changes: 3 additions & 2 deletions lib/commands/impl/init/flutter/init_katteko.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../../../../functions/create/create_list_directory.dart';
import '../../../../functions/create/create_main.dart';
import '../../../../samples/impl/arctekko/arc_main.dart';
import '../../../../samples/impl/arctekko/config_example.dart';
import '../../commads_export.dart';
import '../../commands_export.dart';
import '../../install/install_get.dart';

Future<void> createInitKatekko() async {
Expand Down Expand Up @@ -38,5 +38,6 @@ Future<void> createInitKatekko() async {
]);
createListDirectory(initialDirs);

LogService.success(Translation(LocaleKeys.sucess_clean_Pattern_generated).tr);
LogService.success(
Translation(LocaleKeys.success_clean_Pattern_generated).tr);
}
2 changes: 1 addition & 1 deletion lib/commands/impl/install/install.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../../../common/utils/logger/log_utils.dart';
import '../../../common/utils/pubspec/pubspec_utils.dart';
import '../../../common/utils/shell/shel.utils.dart';
import '../../../common/utils/shell/shell.utils.dart';
import '../../../core/internationalization.dart';
import '../../../core/locales.g.dart';
import '../../../exception_handler/exceptions/cli_exception.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/remove/remove.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../../../common/utils/logger/log_utils.dart';
import '../../../common/utils/pubspec/pubspec_utils.dart';
import '../../../common/utils/shell/shel.utils.dart';
import '../../../common/utils/shell/shell.utils.dart';
import '../../../core/internationalization.dart';
import '../../../core/locales.g.dart';
import '../../../exception_handler/exceptions/cli_exception.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/impl/sort/sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SortCommand extends Command {
skipRename: containsArg('--skipRename'),
useRelativeImport: containsArg('--relative'));
LogService.success(
LocaleKeys.sucess_file_formatted.trArgs([element.path]));
LocaleKeys.success_file_formatted.trArgs([element.path]));
}
});
}
Expand All @@ -72,7 +72,7 @@ class SortCommand extends Command {
logger: false,
skipRename: containsArg('--skipRename'),
useRelativeImport: containsArg('--relative'));
LogService.success(LocaleKeys.sucess_file_formatted.trArgs([path]));
LogService.success(LocaleKeys.success_file_formatted.trArgs([path]));
} else {
throw CliException(LocaleKeys.error_invalid_dart.trArgs([path]));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/impl/update/update.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../../../common/utils/shell/shel.utils.dart';
import '../../../common/utils/shell/shell.utils.dart';
import '../../../core/internationalization.dart';
import '../../../core/locales.g.dart';
import '../../interface/command.dart';
Expand Down
16 changes: 8 additions & 8 deletions lib/commands/interface/command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ abstract class Command with ArgsMixin {
bool validate() {
if (GetCli.arguments.contains(commandName) ||
GetCli.arguments.contains('$commandName:$name')) {
var flagsNotAceppts = flags;
flagsNotAceppts.removeWhere((element) => acceptedFlags.contains(element));
if (flagsNotAceppts.isNotEmpty) {
var flagsNotAccepts = flags;
flagsNotAccepts.removeWhere((element) => acceptedFlags.contains(element));
if (flagsNotAccepts.isNotEmpty) {
LogService.info(LocaleKeys.info_unnecessary_flag.trArgsPlural(
LocaleKeys.info_unnecessary_flag_prural,
flagsNotAceppts.length,
[flagsNotAceppts.toString()],
LocaleKeys.info_unnecessary_flag_plural,
flagsNotAccepts.length,
[flagsNotAccepts.toString()],
)!);
}

Expand All @@ -61,6 +61,6 @@ abstract class Command with ArgsMixin {
/// execute command
Future<void> execute();

/// childrens command
List<Command> get childrens => [];
/// children command
List<Command> get children => [];
}
30 changes: 15 additions & 15 deletions lib/common/utils/json_serialize/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ const Map<String, bool> PRIMITIVE_TYPES = {

enum ListType { Object, String, Double, Int, Null }

class MergeableListType {
class MergeAbleListType {
final ListType? listType;
final bool isAmbigous;
final bool isAmbiguous;

MergeableListType(this.listType, this.isAmbigous);
MergeAbleListType(this.listType, this.isAmbiguous);
}

MergeableListType mergeableListType(List<dynamic> list) {
MergeAbleListType mergeAbleListType(List<dynamic> list) {
ListType? t = ListType.Null;
var isAmbigous = false;
var isAmbiguous = false;
for (var e in list) {
ListType? inferredType;
if (e.runtimeType.toString() == 'int') {
Expand All @@ -47,11 +47,11 @@ MergeableListType mergeableListType(List<dynamic> list) {
inferredType = ListType.Object;
}
if (t != ListType.Null && t != inferredType) {
isAmbigous = true;
isAmbiguous = true;
}
t = inferredType;
}
return MergeableListType(t, isAmbigous);
return MergeAbleListType(t, isAmbiguous);
}

String camelCase(String text) {
Expand Down Expand Up @@ -103,16 +103,16 @@ WithWarning<Map> mergeObj(Map obj, Map other, String path) {
} else if (t == 'List') {
var l = List.from(clone[k] as Iterable);
l.addAll(other[k] as Iterable);
final mergeableType = mergeableListType(l);
if (ListType.Object == mergeableType.listType) {
final mergeAbleType = mergeAbleListType(l);
if (ListType.Object == mergeAbleType.listType) {
var mergedList = mergeObjectList(l, '$path');
warnings.addAll(mergedList.warnings);
clone[k] = List.filled(1, mergedList.result);
} else {
if (l.isNotEmpty) {
clone[k] = List.filled(1, l[0]);
}
if (mergeableType.isAmbigous) {
if (mergeAbleType.isAmbiguous) {
warnings.add(newAmbiguousType('$path/$k'));
}
}
Expand Down Expand Up @@ -149,24 +149,24 @@ WithWarning<Map> mergeObjectList(List<dynamic> list, String path,
if (idx != -1) {
realIndex = idx - i;
}
final ambiguosTypePath = '$path[$realIndex]/$k';
warnings.add(newAmbiguousType(ambiguosTypePath));
final ambiguousTypePath = '$path[$realIndex]/$k';
warnings.add(newAmbiguousType(ambiguousTypePath));
}
} else if (t == 'List') {
var l = List.from(obj[k] as Iterable);
final beginIndex = l.length;
l.addAll(v as Iterable);
// bug is here
final mergeableType = mergeableListType(l);
if (ListType.Object == mergeableType.listType) {
final mergeAbleType = mergeAbleListType(l);
if (ListType.Object == mergeAbleType.listType) {
var mergedList = mergeObjectList(l, '$path[$i]/$k', beginIndex);
warnings.addAll(mergedList.warnings);
obj[k] = List.filled(1, mergedList.result);
} else {
if (l.isNotEmpty) {
obj[k] = List.filled(1, l[0]);
}
if (mergeableType.isAmbigous) {
if (mergeAbleType.isAmbiguous) {
warnings.add(newAmbiguousType('$path[$i]/$k'));
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/common/utils/json_serialize/model_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ModelGenerator {
final astNode = parse(rawJson, Settings());
var warnings =
_generateClassDefinition(_rootClassName, jsonRawData, '', astNode);
// after generating all classes, replace the omited similar classes.
// after generating all classes, replace the omitted similar classes.
for (var c in allClasses) {
final fieldsKeys = c.fields.keys;
for (var f in fieldsKeys) {
Expand Down
9 changes: 5 additions & 4 deletions lib/common/utils/pubspec/pubspec_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../../../exception_handler/exceptions/cli_exception.dart';
import '../../../extensions.dart';
import '../logger/log_utils.dart';
import '../pub_dev/pub_dev_api.dart';
import '../shell/shel.utils.dart';
import '../shell/shell.utils.dart';
import 'yaml_to.string.dart';

// ignore: avoid_classes_with_only_static_members
Expand All @@ -20,7 +20,7 @@ class PubspecUtils {
static PubSpec get pubSpec =>
PubSpec.fromYamlString(_pubspecFile.readAsStringSync());

/// separtor
/// separator
static final _mapSep = _PubValue<String>(() {
var yaml = pubSpec.unParsedYaml!;
if (yaml.containsKey('get_cli')) {
Expand Down Expand Up @@ -84,7 +84,7 @@ class PubspecUtils {

_savePub(pubSpec);
if (runPubGet) await ShellUtils.pubGet();
LogService.success(LocaleKeys.sucess_package_installed.trArgs([package]));
LogService.success(LocaleKeys.success_package_installed.trArgs([package]));
return true;
}

Expand All @@ -103,7 +103,8 @@ class PubspecUtils {
);
_savePub(newPub);
if (logger) {
LogService.success(LocaleKeys.sucess_package_removed.trArgs([package]));
LogService.success(
LocaleKeys.success_package_removed.trArgs([package]));
}
} else if (logger) {
LogService.info(LocaleKeys.info_package_not_installed.trArgs([package]));
Expand Down
12 changes: 8 additions & 4 deletions lib/common/utils/pubspec/yaml_to.string.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
final _unsuportedCharacters = RegExp(
final _unSupportedCharacters = RegExp(
r'''^[\n\t ,[\]{}#&*!|<>'"%@']|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$''');

class CliYamlToString {
Expand Down Expand Up @@ -40,7 +40,7 @@ class CliYamlToString {
String _escapeString(String line) {
line = line.replaceAll('"', r'\"').replaceAll('\n', r'\n');

if (line.contains(_unsuportedCharacters)) {
if (line.contains(_unSupportedCharacters)) {
line = quotes + line + quotes;
}

Expand Down Expand Up @@ -68,14 +68,18 @@ class CliYamlToString {
if (value is Iterable || value is Map) {
_writeIndent(indentCount, stringSink);
}
stringSink..write(key)..write(_divider);
stringSink
..write(key)
..write(_divider);
_writeYamlString(value, indentCount, stringSink, false, false);
}
} else {
for (var key in keys) {
final value = node[key];
_writeIndent(indentCount, stringSink);
stringSink..write(key)..write(_divider);
stringSink
..write(key)
..write(_divider);
_writeYamlString(value, indentCount, stringSink, false, false);
if (value is Map || value is Iterable) {
if (isTopLevel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ShellUtils {
await run('flutter pub global activate get_cli', verbose: true);
}
}
return LogService.success(LocaleKeys.sucess_update_cli.tr);
return LogService.success(LocaleKeys.success_update_cli.tr);
} on Exception catch (err) {
LogService.info(err.toString());
return LogService.error(LocaleKeys.error_update_cli.tr);
Expand Down
Loading