duplicateCommand method
Duplicate command.
Implementation
void duplicateCommand(String id, NmTelecomL10n l10n) {
final value = selected;
if (value == null || value.isSystem) return;
final source = value.commands.singleWhere((item) => item.id == id);
final nextId = _uniqueId('${source.id}_copy', value.commands.map((item) => item.id));
final copy = source.copyWith(
id: nextId,
name: '${source.name}${l10n.cmdSetCopySuffix}',
operations: [for (final operation in source.operations) operation.copyWithId('${operation.id}_copy')],
);
_update(value.copyWith(commands: [...value.commands, copy]));
selectedCommandId = nextId;
}