save method
Save current settings as a named profile
Profiles are stored in ~/.claudio/profiles/ and can be loaded with the --profile flag.
Implementation
@cliCommand
Future<void> save(
/// Profile name (alphanumeric, hyphens, underscores)
String name, {
/// Source directory
String? source,
/// Project type
String? type,
/// Output prefix
String? prefix,
/// Max size in KB
int? maxSize,
/// Remove comments
bool removeComments = true,
/// Output format (text, markdown, json)
String format = 'text',
}) async {
final config = GenConfig.withDefaults().copyWith(
sourceDir: source,
projectTypeName: type,
outputPrefix: prefix,
targetSizeKB: maxSize,
removeComments: removeComments,
outputFormatName: format,
);
final manager = ProfileManager.withDefaults();
if (await manager.profileExists(name)) {
final overwrite = await UserPrompt.askYesNo(
'Profile "$name" already exists. Overwrite?',
defaultValue: false,
);
if (!overwrite) {
warn('Cancelled');
return;
}
}
await manager.saveProfile(name, config);
success('Profile "$name" saved successfully');
info('Use with: claudio gen run --profile $name');
}