generate method

  1. @override
Command generate(
  1. Context context
)
override

Implementation

@override
Command generate(Context context) {
  if (isRecursive != null && isRecursive!) path = context.file;

  pack ??= context.packId;

  final argString = switch (arguments) {
    Map _ => ' ${gson.encode(arguments)}',
    Entity e => ' with entity $e',
    Block b => ' with block $b',
    Storage(name: final name, key: final String key) =>
      ' with storage ${DataStorage(name).toString(context)} $key',
    _ => ''
  };

  return Command('function $pack:$path$argString');
}