liveShellArgumentsError function
Why metro live won't take the command in rest, and where that command
runs instead.
Implementation
String liveShellArgumentsError(List<String> rest) {
final String name = rest.first;
final String typed = [
for (final String word in rest)
!word.contains(RegExp(r'\s'))
? word
: word.contains("'")
? '"$word"'
: "'$word'",
].join(' ');
if (_isShellOnly(name)) {
return '$name runs inside the shell. Open metro live and type $typed';
}
final String? oneShot = liveRunActions.containsKey(name)
? 'metro live:run $typed'
: liveBuiltInCommands.containsKey('live:$name')
? 'metro live:$typed'
: name.contains(':')
? 'metro $typed'
: null;
return 'metro live opens a shell and only takes -d, --all, --uri and '
'--timeout. ${oneShot == null ? 'Open it and type $typed there.' : 'To run one command, use $oneShot'}';
}