Skip to content

Commit d52ddef

Browse files
committed
Merge pull request #1855 from wheels-dev/fix/fixes-for-cli
Fix/fixes for cli
1 parent 6e58ac8 commit d52ddef

File tree

11 files changed

+56
-65
lines changed

11 files changed

+56
-65
lines changed

cli/src/commands/wheels/analyze/code.cfc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ component extends="../base" {
180180
// Display issues by file
181181
if (structCount(results.files) > 0) {
182182
detailOutput.subHeader("Issues by File");
183+
var filteredSeverity = lcase(arguments.severity);
183184
for (var filePath in results.files) {
184185
var fileIssues = results.files[filePath];
185186
var relativePath = replace(filePath, getCWD(), "");
@@ -189,15 +190,13 @@ component extends="../base" {
189190
// Group issues by severity for better readability
190191
var groupedIssues = groupIssuesBySeverity(fileIssues);
191192

192-
for (var severity in ["error", "warning", "info"]) {
193-
if (structKeyExists(groupedIssues, severity) && arrayLen(groupedIssues[severity]) > 0) {
194-
for (var issue in groupedIssues[severity]) {
195-
var icon = getSeverityIcon(issue.severity);
196-
var color = getSeverityColor(issue.severity);
193+
if (structKeyExists(groupedIssues, filteredSeverity) && arrayLen(groupedIssues[filteredSeverity]) > 0) {
194+
for (var issue in groupedIssues[filteredSeverity]) {
195+
var icon = getSeverityIcon(issue.severity);
196+
var color = getSeverityColor(issue.severity);
197197

198-
detailOutput.output("#icon# Line #issue.line#:#issue.column# - #issue.message#", true);
199-
print.cyanLine(" Rule: #issue.rule#" & (issue.fixable ? " [Auto-fixable]" : "")).toConsole();
200-
}
198+
detailOutput.output("#icon# Line #issue.line#:#issue.column# - #issue.message#", true);
199+
print.cyanLine(" Rule: #issue.rule#" & (issue.fixable ? " [Auto-fixable]" : "")).toConsole();
201200
}
202201
}
203202

cli/src/commands/wheels/config/dump.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ component extends="commandbox.modules.wheels-cli.commands.wheels.base" {
8888
// Output to console if not table format
8989
if(arguments.format == "json"){
9090
detailOutput.line();
91-
detailOutput.output(deserializeJSON(local.outputContent));
91+
detailOutput.getPrint().line(deserializeJSON(local.outputContent)).toConsole();
9292
} else {
9393
detailOutput.line();
9494
detailOutput.output(local.outputContent);

cli/src/commands/wheels/generate/code.cfc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ component aliases="wheels g code" extends="../base" {
2121
* @force.hint Overwrite existing files
2222
*/
2323
function run(
24-
required string pattern,
24+
string pattern,
2525
boolean list = false,
2626
string category = "",
2727
string output = "console",
@@ -53,16 +53,16 @@ component aliases="wheels g code" extends="../base" {
5353

5454
if (!len(arguments.pattern)) {
5555
detailOutput.error("Pattern name is required");
56-
detailOutput.getPrint().line("Usage: wheels g code <pattern-name>");
57-
detailOutput.getPrint().line("Run 'wheels g code --list' to see available patterns");
56+
detailOutput.output("Usage: wheels g code <pattern-name>", true);
57+
detailOutput.output("Run 'wheels g code --list' to see available patterns", true);
5858
setExitCode(1);
5959
return;
6060
}
6161

6262
var snippet = getSnippetByName(arguments.pattern);
6363
if (!structCount(snippet)) {
6464
detailOutput.error("Code snippet '#arguments.pattern#' not found");
65-
detailOutput.getPrint().line("Run 'wheels g code --list' to see available patterns");
65+
detailOutput.output("Run 'wheels g code --list' to see available patterns", true);
6666
setExitCode(1);
6767
return;
6868
}
@@ -102,16 +102,16 @@ component aliases="wheels g code" extends="../base" {
102102
for (var cat in categoryOrder) {
103103
var key = lCase(cat);
104104
if (structKeyExists(categories, key)) {
105-
detailOutput.getPrint().line("");
106-
detailOutput.getPrint().boldLine("#cat#:");
105+
detailOutput.line();
106+
detailOutput.getPrint().boldLine("#cat#:").toConsole();
107107
for (var snippet in categories[key]) {
108-
detailOutput.getPrint().line(" - #snippet.name# - #snippet.description#");
108+
detailOutput.output(" - #snippet.name# - #snippet.description#", true);
109109
}
110110
}
111111
}
112112

113-
detailOutput.getPrint().line("");
114-
detailOutput.getPrint().line("");
113+
detailOutput.line();
114+
detailOutput.line();
115115
detailOutput.nextSteps([
116116
"Generate a code snippet: wheels g code <pattern-name>"
117117
]);
@@ -122,11 +122,11 @@ component aliases="wheels g code" extends="../base" {
122122
*/
123123
private function printSnippet(required struct snippet) {
124124
detailOutput.header("Generating Code Snippet: #arguments.snippet.name#");
125-
detailOutput.getPrint().line("");
125+
detailOutput.line();
126126

127127
var content = getSnippetContent(arguments.snippet);
128-
detailOutput.getPrint().line(content);
129-
detailOutput.getPrint().line("");
128+
detailOutput.output("#content#");
129+
detailOutput.line();
130130

131131
detailOutput.success("Code snippet '#arguments.snippet.name#' generated successfully!");
132132
}
@@ -140,7 +140,7 @@ component aliases="wheels g code" extends="../base" {
140140

141141
if (fileExists(resolvedPath) && !arguments.force) {
142142
detailOutput.error("File already exists: #resolvedPath#");
143-
detailOutput.getPrint().line("Use --force to overwrite");
143+
detailOutput.output("Use --force to overwrite", true);
144144
setExitCode(1);
145145
return;
146146
}
@@ -429,9 +429,9 @@ component aliases="wheels g code" extends="../base" {
429429
*/
430430
private function showCustomizationOptions() {
431431
detailOutput.header("Customization Options");
432-
detailOutput.getPrint().line("You can customize code snippets by:");
433-
detailOutput.getPrint().line(" 1. Creating custom code snippets with --create");
434-
detailOutput.getPrint().line(" 2. Saving code snippets to files with --output=file");
435-
detailOutput.getPrint().line(" 3. Filtering by category with --category");
432+
detailOutput.output("You can customize code snippets by:");
433+
detailOutput.output(" 1. Creating custom code snippets with --create");
434+
detailOutput.output(" 2. Saving code snippets to files with --output=file");
435+
detailOutput.output(" 3. Filtering by category with --category");
436436
}
437437
}

cli/src/commands/wheels/generate/scaffold.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ component aliases="wheels g scaffold, wheels g resource, wheels generate resourc
101101
// Run migrations if requested
102102
if (arguments.migrate) {
103103
detailOutput.invoke("dbmigrate");
104-
command('wheels dbmigrate up').run();
104+
command('wheels dbmigrate latest').run();
105105
} else if (!arguments.api) {
106106
// Only ask to migrate in interactive mode
107107
try {
108108
if (confirm("Would you like to run migrations now? [y/n]")) {
109109
detailOutput.invoke("dbmigrate");
110-
command('wheels dbmigrate up').run();
110+
command('wheels dbmigrate latest').run();
111111
}
112112
} catch (any e) {
113113
// Skip if non-interactive

cli/src/commands/wheels/get/settings.cfc

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -207,39 +207,35 @@ component extends="../base" {
207207

208208
private void function parseSettings(required string content, required struct settings) {
209209
// Parse set() calls in the settings file
210-
local.pattern = 'set\s*\(\s*([^=]+)\s*=\s*([^)]+)\)';
210+
local.pattern = 'set\s*\(\s*([^=\s]+(?:\s*[^=\s]*)*)\s*=\s*([^)]+)\)';
211211
local.matches = REMatchNoCase(local.pattern, arguments.content);
212212

213213
for (local.match in local.matches) {
214214
try {
215215
// Extract key and value
216-
local.parts = REFind(local.pattern, local.match, 1, true);
216+
local.extractPattern = 'set\s*\(\s*([^=]+?)\s*=\s*([^)]+)\)';
217+
local.parts = REFindNoCase(local.extractPattern, local.match, 1, true);
218+
217219
if (local.parts.pos[1] > 0) {
218-
local.assignment = Mid(local.match, local.parts.pos[2], local.parts.len[2]);
219-
local.assignParts = ListToArray(local.assignment, "=");
220-
if (ArrayLen(local.assignParts) >= 2) {
221-
local.key = Trim(local.assignParts[1]);
222-
// Join remaining parts with = in case value contains =
223-
local.valueParts = [];
224-
for (local.i = 2; local.i <= ArrayLen(local.assignParts); local.i++) {
225-
ArrayAppend(local.valueParts, local.assignParts[local.i]);
226-
}
227-
local.value = Trim(ArrayToList(local.valueParts, "="));
228-
229-
// Clean up the value
230-
local.value = REReplace(local.value, "^['""]|['""]$", "", "all");
231-
232-
// Try to parse boolean/numeric values
233-
if (local.value == "true") {
234-
local.value = true;
235-
} else if (local.value == "false") {
236-
local.value = false;
237-
} else if (IsNumeric(local.value)) {
238-
local.value = Val(local.value);
239-
}
240-
241-
arguments.settings[local.key] = local.value;
220+
// Extract key (trim whitespace)
221+
local.key = Trim(Mid(local.match, local.parts.pos[2], local.parts.len[2]));
222+
223+
// Extract value (trim whitespace)
224+
local.value = Trim(Mid(local.match, local.parts.pos[3], local.parts.len[3]));
225+
226+
// Clean up quotes from the value
227+
local.value = REReplace(local.value, "^['""]|['""]$", "", "all");
228+
229+
// Try to parse boolean/numeric values
230+
if (local.value == "true") {
231+
local.value = true;
232+
} else if (local.value == "false") {
233+
local.value = false;
234+
} else if (IsNumeric(local.value)) {
235+
local.value = Val(local.value);
242236
}
237+
238+
arguments.settings[local.key] = local.value;
243239
}
244240
} catch (any e) {
245241
// Skip malformed settings

cli/src/commands/wheels/plugins/list.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ component aliases="wheels plugin list" extends="../base" {
8787
}
8888

8989
// Display the table
90-
detailOutput.getPrint().table(rows);
90+
detailOutput.getPrint().table(rows).toConsole();
9191

9292
detailOutput.line();
9393
detailOutput.divider("-", 60);

cli/src/commands/wheels/plugins/outdated.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ component aliases="wheels plugin outdated,wheels plugins outdated" extends="../b
130130
}
131131

132132
// Display the table
133-
print.table(rows);
133+
print.table(rows).toConsole();
134134

135135
detailOutput.line();
136136
detailOutput.divider("-", 60);

cli/src/commands/wheels/plugins/search.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ component aliases="wheels plugin search" extends="../base" {
170170

171171

172172
// Display the table
173-
detailOutput.getPrint().table(rows);
173+
detailOutput.getPrint().table(rows).toConsole();
174174

175175
detailOutput.line();
176176
detailOutput.divider();

cli/src/commands/wheels/plugins/update.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ component aliases="wheels plugin update" extends="../base" {
196196
// Show version comparison
197197
detailOutput.subHeader("Update Summary");
198198
detailOutput.metric("Plugin", pluginInfo.name);
199-
detailOutput.update("Version", "v#currentVersion# → v#targetVersion#");
199+
detailOutput.metric("Version", "v#currentVersion# → v#targetVersion#");
200200
detailOutput.metric("Location", "/plugins/#foundPlugin.folderName#");
201201
detailOutput.line();
202202

cli/src/commands/wheels/plugins/updateAll.cfc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* wheels plugin update:all
55
* wheels plugin update:all --dryRun
66
*/
7-
component aliases="wheels plugin update:all,wheels plugins update:all" extends="../base" {
7+
component aliases="wheels plugin update:all,wheels plugins update:all, wheels plugin updateall" extends="../base" {
88

99
property name="pluginService" inject="PluginService@wheels-cli";
1010
property name="packageService" inject="PackageService";
@@ -122,7 +122,7 @@ component aliases="wheels plugin update:all,wheels plugins update:all" extends="
122122
});
123123
}
124124

125-
print.table(updateRows);
125+
print.table(updateRows).toConsole();
126126
detailOutput.line();
127127

128128
if (arguments.dryRun) {
@@ -198,7 +198,6 @@ component aliases="wheels plugin update:all,wheels plugins update:all" extends="
198198

199199
// Show final summary
200200
detailOutput.line();
201-
detailOutput.divider("=", 60);
202201
detailOutput.header("Update Summary");
203202
detailOutput.line();
204203

@@ -214,7 +213,7 @@ component aliases="wheels plugin update:all,wheels plugins update:all" extends="
214213
arrayAppend(summaryRows, { "Status" = "Check errors", "Count" = "#arrayLen(errors)#" });
215214
}
216215

217-
print.table(summaryRows);
216+
print.table(summaryRows).toConsole();
218217
detailOutput.line();
219218

220219
if (successCount > 0) {

0 commit comments

Comments
 (0)