You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Toolkit] Improve InstallComponentCommand by asking/guessing which Kit to use, remove ux_toolkit.kit parameter, remove DependencyInjection configuration
$kitName = $io->choice(\sprintf('The component "%s" exists in multiple kits. Which one do you want to use?', $componentName), array_map(fn (Kit$kit) => $kit->name, $availableKits));
107
+
} else {
108
+
$kitName = $io->choice('Which kit do you want to use?', array_map(fn (Kit$kit) => $kit->name, $availableKits));
109
+
}
110
+
foreach ($availableKitsas$availableKit) {
111
+
if ($availableKit->name === $kitName) {
112
+
$kit = $availableKit;
113
+
break;
114
+
}
115
+
}
116
+
} elseif (1 === $availableKitsCount) {
117
+
$kit = $availableKits[0];
118
+
} else {
119
+
$io->error('No kit found. Please provide a kit name using the --kit option.');
if (null === $componentName = $input->getArgument('component')) {
128
+
if (null === $componentName) {
99
129
// Ask for the component name if not provided
100
130
$componentName = $io->choice('Which component do you want to install?', array_map(fn (Component$component) => $component->name, $this->getAvailableComponents($kit)));
101
131
$component = $kit->getComponent($componentName);
@@ -124,7 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
124
154
}
125
155
}
126
156
127
-
$io->writeln(\sprintf('Installing component <info>%s</> from the <info>%s</> kit...', $component->name, $kitName));
157
+
$io->writeln(\sprintf('Installing component <info>%s</> from the <info>%s</> kit...', $component->name, $kit->name));
0 commit comments