diff --git a/tools/brick_generator/lib/file_system_utils.dart b/tools/brick_generator/lib/file_system_utils.dart
index 8c7fa6e..749af84 100644
--- a/tools/brick_generator/lib/file_system_utils.dart
+++ b/tools/brick_generator/lib/file_system_utils.dart
@@ -50,7 +50,9 @@ class FileSystemUtils {
}
}
}
- Logger.info('Variable ${variable?.name} added in ${file.path}');
+ Logger.debug(
+ 'Variable `${variable?.name}` replaced in ${file.path}',
+ );
}
}
@@ -90,6 +92,9 @@ class FileSystemUtils {
await File(newPath).create(recursive: true);
await file.rename(newPath);
+ Logger.debug(
+ '${file.path} renamed with variable `${variable.name}`',
+ );
}
}
}
diff --git a/tools/brick_generator/lib/logger.dart b/tools/brick_generator/lib/logger.dart
index 1f46e4e..1e60a6d 100644
--- a/tools/brick_generator/lib/logger.dart
+++ b/tools/brick_generator/lib/logger.dart
@@ -23,6 +23,10 @@ class Logger {
stdout.writeln('${level.prefix} ${message.toString()}');
}
+ static void debug(Object? message) {
+ log(message, level: LogLevel.debug);
+ }
+
static void info(Object? message) {
log(message);
}
diff --git a/tools/brick_generator/lib/models/brick_config.dart b/tools/brick_generator/lib/models/brick_config.dart
index d719745..ebeb935 100644
--- a/tools/brick_generator/lib/models/brick_config.dart
+++ b/tools/brick_generator/lib/models/brick_config.dart
@@ -80,9 +80,6 @@ description: $description
version: $version
-environment:
- mason: ">=0.1.0-dev.26 <0.1.0"
-
''';
if (variables?.isNotEmpty ?? false) {
diff --git a/tools/brick_generator/lib/models/log_level.dart b/tools/brick_generator/lib/models/log_level.dart
index ea214a5..73a0ec1 100644
--- a/tools/brick_generator/lib/models/log_level.dart
+++ b/tools/brick_generator/lib/models/log_level.dart
@@ -15,6 +15,7 @@
// along with this program. If not, see .
enum LogLevel {
+ debug('💡'),
info('🍺'),
success('✅'),
error('❌');
diff --git a/tools/brick_generator/lib/models/variable_string_syntax.dart b/tools/brick_generator/lib/models/variable_string_syntax.dart
index daa840e..8b59d3f 100644
--- a/tools/brick_generator/lib/models/variable_string_syntax.dart
+++ b/tools/brick_generator/lib/models/variable_string_syntax.dart
@@ -1,16 +1,16 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
-//
+//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
@@ -25,7 +25,9 @@ enum VariableStringSyntax {
paramCase('param_case', 'paramCase'),
sentenceCase('sentence_case', 'sentenceCase'),
titleCase('title_case', 'titleCase'),
- upperCase('upper_case', 'upperCase');
+ upperCase('upper_case', 'upperCase'),
+ pathCase('path_case', 'pathCase'),
+ mustacheCase('mustache_case', 'mustacheCase');
final String mapKey;
final String id;
diff --git a/tools/brick_generator/lib/string_extension.dart b/tools/brick_generator/lib/string_extension.dart
index 3b51873..2dcbebf 100644
--- a/tools/brick_generator/lib/string_extension.dart
+++ b/tools/brick_generator/lib/string_extension.dart
@@ -29,6 +29,8 @@ extension StringExtension on String {
'title_case': title(),
'upper_case': upper(),
'snake_case': snake(),
+ 'mustache_case': mustache(),
+ 'path_case': path(),
};
/// ```dart
@@ -214,6 +216,30 @@ extension StringExtension on String {
}
}
+ /// ```dart
+ /// print('Hello World'.path()) // hello/world
+ /// print('helloWorld'.path()) // hello/world
+ /// print('long space'.path()) // long/space
+ /// ```
+ String path() {
+ switch (length) {
+ case 0:
+ return this;
+ case 1:
+ return toLowerCase();
+ default:
+ return splitMapJoin(
+ RegExp('[A-Z]'),
+ onMatch: (m) => ' ${m[0]}',
+ onNonMatch: (n) => n,
+ ).trim().splitMapJoin(
+ _defaultMatcher,
+ onMatch: (m) => '/',
+ onNonMatch: (n) => n.toLowerCase(),
+ );
+ }
+ }
+
/// ```dart
/// print('Hello World'.upper()) // HELLO WORLD
/// print('helloWorld'.upper()) // HELLO WORLD
@@ -280,4 +306,12 @@ extension StringExtension on String {
onNonMatch: (n) => n,
);
}
+
+ /// ```dart
+ /// print('Hello World'.mustache()) // {{ Hello World }}
+ /// print('helloWorld'.mustache()) // {{ Hello World }}
+ /// ```
+ String mustache() {
+ return '{{ ${title()} }}';
+ }
}