checkArguments function
Detects if the first argument is a directory and if so, adds 'run' before it. This should run the app at that location
Implementation
List<String> checkArguments(List<String> args) {
final isCommand = app.commands.containsKey(args.firstOrNull);
final isFlag = app.argParser.options.containsKey(args.firstOrNull);
bool isDirectory(dir) {
dir = p.normalize(p.absolute(dir));
return Directory(dir).existsSync();
}
if (args.isNotEmpty && !isCommand && !isFlag && isDirectory(args.first)) {
args = ['run', ...args];
}
return args;
}