docs: update TODO.md and changelog for modular CLI milestone
This commit is contained in:
parent
39e05be88a
commit
b83fa060e2
54 changed files with 7696 additions and 99 deletions
39
src/apt-ostree.py/client/commands/initramfs.py
Normal file
39
src/apt-ostree.py/client/commands/initramfs.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"""
|
||||
Initramfs command for apt-ostree CLI.
|
||||
|
||||
This module implements the 'initramfs' command for managing initramfs
|
||||
using the apt-ostree daemon.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from typing import Any
|
||||
|
||||
def setup_parser(subparsers: argparse._SubParsersAction):
|
||||
initramfs_parser = subparsers.add_parser('initramfs', help='Manage initramfs')
|
||||
initramfs_parser.add_argument('action', choices=['enable', 'disable', 'regenerate'], help='Action to perform')
|
||||
|
||||
def run(cli: Any, args: argparse.Namespace) -> int:
|
||||
try:
|
||||
if args.action == 'enable':
|
||||
print("Enabling initramfs regeneration...")
|
||||
result = cli.call_daemon_method('EnableInitramfs')
|
||||
elif args.action == 'disable':
|
||||
print("Disabling initramfs regeneration...")
|
||||
result = cli.call_daemon_method('DisableInitramfs')
|
||||
elif args.action == 'regenerate':
|
||||
print("Regenerating initramfs...")
|
||||
result = cli.call_daemon_method('RegenerateInitramfs')
|
||||
else:
|
||||
print("Error: Invalid action for initramfs command")
|
||||
return 1
|
||||
if result.get('success'):
|
||||
print(f"✓ Initramfs action '{args.action}' completed successfully")
|
||||
return 0
|
||||
else:
|
||||
print(f"✗ Initramfs action '{args.action}' failed: {result.get('error', 'Unknown error')}")
|
||||
cli.logger.error(f"Initramfs action '{args.action}' failed: {result.get('error', 'Unknown error')}")
|
||||
return 1
|
||||
except Exception as e:
|
||||
print(f"Error managing initramfs: {e}")
|
||||
cli.logger.error(f"Error managing initramfs: {e}")
|
||||
return 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue