getNamespaces method

List<String> getNamespaces()
inherited

Returns all unique namespace prefixes from registered commands.

For a command named cache:clear, this produces ['cache']. For nested namespaces like cache:foo:bar, this produces ['cache', 'cache:foo'].

This is equivalent to Symfony Console's Application::getNamespaces().

Implementation

List<String> getNamespaces() {
  final namespaces = <String>{};
  for (final command in commands.values) {
    if (command.hidden) continue;
    for (final ns in _extractAllNamespaces(command.name)) {
      namespaces.add(ns);
    }
  }
  final sorted = namespaces.toList()..sort();
  return sorted;
}