multipassGenerators top-level property
Implementation
final Map<String, FigGenerator> multipassGenerators = {
'allAvailableImages': FigGenerator(
script: ['multipass', 'find', '--format=json'],
postProcess: (String out, [List<String>? tokens]) {
try {
final Map<String, dynamic> json = jsonDecode(out);
final Map<String, dynamic> images = json['images'];
return images.keys.map((key) {
final img = images[key];
return FigSuggestion(
name: key,
description: '${img['os']} ${img['release']}',
);
}).toList();
} catch (e) {
return [];
}
},
),
'allAvailableInstances': FigGenerator(
script: ['multipass', 'list', '--format=json'],
postProcess: (String out, [List<String>? tokens]) =>
_processInstanceList(out, excludeDeleted: true),
),
'allRunningInstances': FigGenerator(
script: ['multipass', 'list', '--format=json'],
postProcess: (String out, [List<String>? tokens]) =>
_processInstanceList(out, requiredState: 'Running'),
),
'allStoppedInstances': FigGenerator(
script: ['multipass', 'list', '--format=json'],
postProcess: (String out, [List<String>? tokens]) =>
_processInstanceList(out, requiredState: 'Stopped'),
),
'allDeletedInstances': FigGenerator(
script: ['multipass', 'list', '--format=json'],
postProcess: (String out, [List<String>? tokens]) =>
_processInstanceList(out, requiredState: 'Deleted'),
),
};