feat(config): Add interactive menu and help to config command, handle unknown commands, and bump dependencies

This commit is contained in:
2025-12-14 10:32:58 +00:00
parent 7bb2f65669
commit 6c62f80c57
5 changed files with 119 additions and 41 deletions

View File

@@ -6,9 +6,15 @@ import { ReleaseConfig } from './classes.releaseconfig.js';
export { ReleaseConfig };
export const run = async (argvArg: any) => {
const command = argvArg._?.[1] || 'show';
const command = argvArg._?.[1];
const value = argvArg._?.[2];
// If no command provided, show interactive menu
if (!command) {
await handleInteractiveMenu();
return;
}
switch (command) {
case 'show':
await handleShow();
@@ -26,11 +32,65 @@ export const run = async (argvArg: any) => {
case 'accessLevel':
await handleAccessLevel(value);
break;
case 'help':
showHelp();
break;
default:
plugins.logger.log('error', `Unknown command: ${command}`);
showHelp();
}
};
/**
* Interactive menu for config command
*/
async function handleInteractiveMenu(): Promise<void> {
console.log('');
console.log('╭─────────────────────────────────────────────────────────────╮');
console.log('│ gitzone config - Release Configuration │');
console.log('╰─────────────────────────────────────────────────────────────╯');
console.log('');
const interactInstance = new plugins.smartinteract.SmartInteract();
const response = await interactInstance.askQuestion({
type: 'list',
name: 'action',
message: 'What would you like to do?',
default: 'show',
choices: [
{ name: 'Show current configuration', value: 'show' },
{ name: 'Add a registry', value: 'add' },
{ name: 'Remove a registry', value: 'remove' },
{ name: 'Clear all registries', value: 'clear' },
{ name: 'Set access level (public/private)', value: 'access' },
{ name: 'Show help', value: 'help' },
],
});
const action = (response as any).value;
switch (action) {
case 'show':
await handleShow();
break;
case 'add':
await handleAdd();
break;
case 'remove':
await handleRemove();
break;
case 'clear':
await handleClear();
break;
case 'access':
await handleAccessLevel();
break;
case 'help':
showHelp();
break;
}
}
/**
* Show current registry configuration
*/