Skip to content

Commit 3f9a040

Browse files
committed
v6.8.1
1 parent 95bc554 commit 3f9a040

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [6.8.1] - 2025-04-16
2+
3+
* Fix `runProcess` in ny_cli.dart
4+
15
## [6.8.0] - 2025-04-16
26

37
* New stub for creating `JourneyState`s in your project

lib/metro/ny_cli.dart

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,8 @@ abstract class NyCustomCommand {
5252
/// Run a process with the given command
5353
runProcess(String command,
5454
{String? workingDirectory, bool? runInShell, bool silent = false}) async {
55-
if (silent == false) {
56-
// Print the command being run
57-
print('Running command: $command');
58-
}
59-
60-
// Split the command into parts
61-
final List<String> parts = command.split(' ');
55+
// Parse command properly handling quotes
56+
final List<String> parts = _parseCommand(command);
6257
final String executable = parts[0];
6358
final List<String> args = parts.sublist(1);
6459

@@ -90,16 +85,50 @@ abstract class NyCustomCommand {
9085
if (exitCode != 0) {
9186
// Print an error message if the process failed
9287
error('Command failed with exit code: $exitCode');
93-
} else {
94-
// Print a success message if the process succeeded
95-
success('Command completed successfully.');
9688
}
9789
}
9890

9991
// Return the exit code
10092
return exitCode;
10193
}
10294

95+
// Helper method to parse command strings correctly handling quotes
96+
List<String> _parseCommand(String command) {
97+
final List<String> parts = [];
98+
bool inQuotes = false;
99+
String currentPart = '';
100+
String quoteChar = '';
101+
102+
for (int i = 0; i < command.length; i++) {
103+
final char = command[i];
104+
105+
if ((char == '"' || char == "'") && (i == 0 || command[i - 1] != '\\')) {
106+
if (!inQuotes) {
107+
inQuotes = true;
108+
quoteChar = char;
109+
} else if (char == quoteChar) {
110+
inQuotes = false;
111+
quoteChar = '';
112+
} else {
113+
currentPart += char;
114+
}
115+
} else if (char == ' ' && !inQuotes) {
116+
if (currentPart.isNotEmpty) {
117+
parts.add(currentPart);
118+
currentPart = '';
119+
}
120+
} else {
121+
currentPart += char;
122+
}
123+
}
124+
125+
if (currentPart.isNotEmpty) {
126+
parts.add(currentPart);
127+
}
128+
129+
return parts;
130+
}
131+
103132
/// Add a package to the pubspec.yaml file
104133
addPackage(String package, {String? version, bool dev = false}) async {
105134
await MetroService.addPackage(package, dev: dev, version: version);

lib/nylo_framework.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ export 'package:date_field/date_field.dart';
2929
export 'package:dio/dio.dart';
3030

3131
/// Nylo version
32-
const String nyloVersion = 'v6.8.0';
32+
const String nyloVersion = 'v6.8.1';

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nylo_framework
22
description: Micro-framework for Flutter that's built to simplify app development for Flutter projects.
3-
version: 6.8.0
3+
version: 6.8.1
44
homepage: https://nylo.dev
55
repository: https://github.com/nylo-core/framework/tree/6.x
66
issue_tracker: https://github.com/nylo-core/framework/issues

0 commit comments

Comments
 (0)