cliSurface function
The whole surface, as flutter3d help --surface prints it and
api/flutter3d_build.cli commits it: the top-level usage, then each
subcommand's own help under a == <command> == line.
Implementation
String cliSurface() {
const usages = <String, String>{
'convert': convertUsage,
'create': createUsage,
'init': initUsage,
'plugins': pluginsUsage,
'shaders': shadersUsage,
'migrate': migrateUsage,
'lights': lightsUsage,
'lightmap': lightmapUsage,
'visibility': visibilityUsage,
'decode-worker': decodeWorkerUsage,
'doctor': doctorUsage,
'help': helpUsage,
};
final sections = <String>[
'== flutter3d ==\n$flutter3dUsage',
for (final command in cliCommands)
if (usages[command] case final String text)
'== $command ==\n${text.trimRight()}',
'== --json ==\n$_jsonBodies',
];
return '${sections.join('\n\n')}\n';
}