feat(action): add group action support
Extended action management to support groups in addition to UPS devices: Changes: - Auto-detects whether target ID is a UPS or group - All action commands now work with both UPS and groups: * nupst action add <ups-id|group-id> * nupst action remove <ups-id|group-id> <index> * nupst action list [ups-id|group-id] - Updated ActionHandler methods to handle both target types - Updated help text and usage examples - List command shows both UPS and group actions when no target specified - Clear labeling in output distinguishes UPS actions from group actions Example usage: nupst action list # Shows all UPS and group actions nupst action add dc-rack-1 # Adds action to group 'dc-rack-1' nupst action remove default 0 # Removes action from UPS 'default' Groups can now have their own shutdown actions, allowing fine-grained control over group behavior during power events.
This commit is contained in:
23
ts/cli.ts
23
ts/cli.ts
@@ -571,9 +571,9 @@ export class NupstCli {
|
||||
|
||||
// Action subcommands
|
||||
logger.log(theme.info('Action Subcommands:'));
|
||||
this.printCommand('nupst action add <ups-id>', 'Add a new action to a UPS');
|
||||
this.printCommand('nupst action remove <ups-id> <index>', 'Remove an action by index');
|
||||
this.printCommand('nupst action list [ups-id]', 'List all actions (optionally for specific UPS)');
|
||||
this.printCommand('nupst action add <target-id>', 'Add a new action to a UPS or group');
|
||||
this.printCommand('nupst action remove <target-id> <index>', 'Remove an action by index');
|
||||
this.printCommand('nupst action list [target-id]', 'List all actions (optionally for specific target)');
|
||||
console.log('');
|
||||
|
||||
// Options
|
||||
@@ -691,18 +691,19 @@ Usage:
|
||||
nupst action <subcommand> [arguments]
|
||||
|
||||
Subcommands:
|
||||
add <ups-id> - Add a new action to a UPS interactively
|
||||
remove <ups-id> <index> - Remove an action by index (alias: rm, delete)
|
||||
list [ups-id] - List all actions (optionally for specific UPS) (alias: ls)
|
||||
add <ups-id|group-id> - Add a new action to a UPS or group interactively
|
||||
remove <ups-id|group-id> <index> - Remove an action by index (alias: rm, delete)
|
||||
list [ups-id|group-id] - List all actions (optionally for specific target) (alias: ls)
|
||||
|
||||
Options:
|
||||
--debug, -d - Enable debug mode for detailed logging
|
||||
--debug, -d - Enable debug mode for detailed logging
|
||||
|
||||
Examples:
|
||||
nupst action list - List actions for all UPS devices
|
||||
nupst action list default - List actions for UPS with ID 'default'
|
||||
nupst action add default - Add a new action to UPS 'default'
|
||||
nupst action remove default 0 - Remove action at index 0 from UPS 'default'
|
||||
nupst action list - List actions for all UPS devices and groups
|
||||
nupst action list default - List actions for UPS or group with ID 'default'
|
||||
nupst action add default - Add a new action to UPS or group 'default'
|
||||
nupst action remove default 0 - Remove action at index 0 from UPS or group 'default'
|
||||
nupst action add dc-rack-1 - Add a new action to group 'dc-rack-1'
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user