Skip to content

Commit 73f63f8

Browse files
committed
Add 'incompatible only' option to interactive menu
- New option: Show only incompatible modules (pre-selected by default) - Improves UX by filtering out compatible modules - Users can still choose 'Show all' for complete overview - Configuration display updated to reflect selection
1 parent 0b999fe commit 73f63f8

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

docs/commands.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,15 @@ bin/magento m:h:c:c
165165
```
166166

167167
The menu allows you to select:
168+
- ☑ Show only incompatible modules (default behavior)
168169
- ☐ Show all modules including compatible ones
169170
- ☐ Include Magento core modules (default: third-party only)
170171
- ☐ Show detailed file-level issues with line numbers
171172

172173
Use **Space** to toggle options, **Enter** to confirm and start the scan.
173174

175+
**Note**: "Show only incompatible" is pre-selected by default, ensuring you only see modules with issues.
176+
174177
**Default Behavior**:
175178
Without any flags, the command scans **third-party modules only** (excludes `Magento_*` modules but includes vendor third-party like Hyva, PayPal, Mollie, etc.).
176179

src/Console/Command/Hyva/CompatibilityCheckCommand.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
9090
label: 'Select scan options',
9191
options: [
9292
'show-all' => 'Show all modules including compatible ones',
93+
'incompatible-only' => 'Show only incompatible modules (default behavior)',
9394
'include-vendor' => 'Include Magento core modules (default: third-party only)',
9495
'detailed' => 'Show detailed file-level issues with line numbers',
9596
],
96-
default: [],
97+
default: ['incompatible-only'],
9798
hint: 'Space to toggle, Enter to confirm. Default: third-party modules only',
9899
required: false,
99100
);
@@ -104,6 +105,7 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
104105

105106
// Apply selected options to input
106107
$showAll = in_array('show-all', $selectedOptions);
108+
$incompatibleOnly = in_array('incompatible-only', $selectedOptions);
107109
$includeVendor = in_array('include-vendor', $selectedOptions);
108110
$detailed = in_array('detailed', $selectedOptions);
109111
$thirdPartyOnly = false; // Not needed in interactive mode
@@ -113,6 +115,10 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
113115
$config = [];
114116
if ($showAll) {
115117
$config[] = 'Show all modules';
118+
} elseif ($incompatibleOnly) {
119+
$config[] = 'Show incompatible only';
120+
} else {
121+
$config[] = 'Show modules with issues';
116122
}
117123
if ($includeVendor) {
118124
$config[] = 'Include Magento core';
@@ -125,8 +131,8 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
125131
$this->io->comment('Configuration: ' . implode(', ', $config));
126132
$this->io->newLine();
127133

128-
// Run scan with selected options
129-
return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, $output);
134+
// Run scan with selected options (pass incompatibleOnly flag)
135+
return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, $incompatibleOnly, $output);
130136
} catch (\Exception $e) {
131137
$this->resetPromptEnvironment();
132138
$this->io->error('Interactive mode failed: ' . $e->getMessage());
@@ -148,7 +154,7 @@ private function runDirectMode(InputInterface $input, OutputInterface $output):
148154

149155
$this->io->title('Hyvä Theme Compatibility Check');
150156

151-
return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, $output);
157+
return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, false, $output);
152158
}
153159

154160
/**
@@ -159,6 +165,7 @@ private function runScan(
159165
bool $thirdPartyOnly,
160166
bool $includeVendor,
161167
bool $detailed,
168+
bool $incompatibleOnly,
162169
OutputInterface $output
163170
): int {
164171

@@ -178,8 +185,17 @@ private function runScan(
178185
$excludeVendor
179186
);
180187

188+
// Determine display mode based on flags
189+
// If incompatibleOnly is set, only show modules with issues
190+
// If showAll is set, show everything
191+
// Otherwise, show default (incompatible only)
192+
$displayShowAll = $showAll;
193+
if ($incompatibleOnly && !$showAll) {
194+
$displayShowAll = false; // Only show incompatible
195+
}
196+
181197
// Display results
182-
$this->displayResults($results, $showAll || $detailed);
198+
$this->displayResults($results, $displayShowAll || $detailed);
183199

184200
// Display detailed issues if requested
185201
if ($detailed && $results['hasIncompatibilities']) {

0 commit comments

Comments
 (0)