Fix module reset command: use getattr for optional args

- Fix AttributeError when calling reset without --all flag
- Use getattr() with defaults for 'all' and 'list_backups' attributes
This commit is contained in:
Vijay Janapa Reddi
2025-11-28 23:39:13 +01:00
parent 54c357f566
commit e159a65118
13 changed files with 3 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ from rich.panel import Panel
from rich.table import Table
from rich.text import Text
from .base import BaseCommand
from ..base import BaseCommand
class ModuleResetCommand(BaseCommand):
@@ -694,11 +694,11 @@ class ModuleResetCommand(BaseCommand):
console = self.console
# Handle --all (reset all modules)
if args.all:
if getattr(args, 'all', False):
return self._reset_all_modules(args)
# Handle --list-backups
if args.list_backups:
if getattr(args, 'list_backups', False):
if not args.module_number:
console.print(
"[red]Error: --list-backups requires a module number[/red]"