getPaths method
Gets valid paths to access values from a map of script definitions.
Implementation
List<String> getPaths() {
final self = this;
final result = <String>[];
for (final k in self.keys) {
if (_metaKeyPattern.hasMatch(k)) continue;
final value = self[k];
if (value is Map) {
final map = value.asJsonMap();
// a group can be runnable itself and still hold sub-commands
if (runnableScripts(map) != null) result.add(k);
result.addAll(map.getPaths().map((v) => '$k $v'));
} else {
result.add(k);
}
}
return result.map((v) => v.trim()).where((v) => v.isNotEmpty).toSet().toList()..sort();
}