Skip to content
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
1 change: 1 addition & 0 deletions lib/commands/commands_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final List<Command> commands = [
RemoveCommand(),
SortCommand(),
UpdateCommand(),
CleanCommand(),
];

class CommandParent extends Command {
Expand Down
29 changes: 29 additions & 0 deletions lib/commands/impl/clean/clean.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import '../../../common/utils/shell/shel.utils.dart';
import '../../../core/internationalization.dart';
import '../../../core/locales.g.dart';
import '../../interface/command.dart';

class CleanCommand extends Command {
@override
String get commandName => 'clean';

@override
Future<void> execute() async {
await ShellUtils.flutterClean();
}

@override
String? get hint => Translation(LocaleKeys.hint_clean).tr;

@override
String get codeSample => 'get clean';

@override
int get maxParameters => 0;

@override
bool validate() {
super.validate();
return true;
}
}
1 change: 1 addition & 0 deletions lib/commands/impl/commads_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export 'remove/remove.dart';
export 'sort/sort.dart';
export 'update/update.dart';
export 'version/version.dart';
export 'clean/clean.dart';
13 changes: 8 additions & 5 deletions lib/common/utils/shell/shel.utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class ShellUtils {
await run('dart pub get', verbose: true);
}

static Future<void> flutterClean() async {
LogService.info('Running `flutter clean` …');
await run('flutter clean', verbose: true);
}

static Future<void> addPackage(String package) async {
LogService.info('Adding package $package …');
await run('dart pub add $package', verbose: true);
Expand All @@ -33,11 +38,9 @@ class ShellUtils {
) async {
LogService.info('Running `flutter create $path` …');

// Note: -i and -a flags are only supported for --template=plugin
// For regular Flutter projects, Flutter uses Swift/Kotlin by default
await run(
'flutter create --no-pub --org $org "$path"',
verbose: true);
// Note: -i and -a flags are only supported for --template=plugin
// For regular Flutter projects, Flutter uses Swift/Kotlin by default
await run('flutter create --no-pub --org $org "$path"', verbose: true);
}

static Future<void> update(
Expand Down
5 changes: 3 additions & 2 deletions lib/core/locales.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ignore_for_file: constant_identifier_names
// ignore: avoid_classes_with_only_static_members


class AppTranslation {
static Map<String, Map<String, String>> translations = {
'tr_TR': Locales.tr_TR,
Expand Down Expand Up @@ -45,6 +44,7 @@ class LocaleKeys {
static const error_access_denied = 'error_access_denied';
static const error_unexpected = 'error_unexpected';
static const example = 'example';
static const hint_clean = 'hint_clean';
static const hint_create_controller = 'hint_create_controller';
static const hint_create_page = 'hint_create_page';
Comment on lines 44 to 49
static const hint_create_project = 'hint_create_project';
Expand Down Expand Up @@ -352,7 +352,8 @@ class Locales {
'error_failed_to_connect': 'Failed to connect with %s.',
'error_no_valid_file_or_url': '%s is not a file or valid url.',
'error_unnecessary_parameter': 'the %s parameter is not necessary.',
'error_unnecessary_parameter_plural': 'the %s parameters are not necessary.',
'error_unnecessary_parameter_plural':
'the %s parameters are not necessary.',
'error_nonexistent_directory': '%s directory does not exist.',
'error_empty_directory': '%s is empty.',
'error_invalid_json': '%s is not a valid json file.',
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"example": "Example:",
"warning": "Warning:",
"hint": {
"clean": "Runs flutter clean",
"create": {
"controller": "Generate controller",
Comment on lines 38 to 41
"page": "Use to generate pages",
Expand Down
Loading