efiboot.cli#
The efiboot
command line interface.
The efiboot CLI is built from command objects. Command objects are implemented
as regular functions annotated with the @command
decorator. The
docstrings of these functions are written in docopt
format, which is used to generate the argv parser.
Custom Commands#
Any Python package may provide a command. To register a new command with
efiboot, a package provides an entry point in the
efiboot_cli
namespace pointing to the command
object.
Example
A minimal command:
# Module: examplepkg.example_command
from efiboot.cli import command
from efiboot.config import Config
@command
def hello(args: Dict[str, Any], config: Config) -> int:
"""A simple command.
Usage:
efiboot hello --name <name>
efiboot hello --help
Options:
--name Your name.
"""
print('hello', args['--name'])
return 0
The command must be registered in the efiboot_cli
entry point:
# File: pyproject.toml
[project.entry-points.efiboot_cli]
hello = 'examplepkg.example_command:hello'
The function can then be called from the command line:
$ efiboot hello --name chris
hello chris
Reference#
Entry Point
Efiboot is a tool for managing EFI boot entries. |
Commands
Get or set the entry to boot into next. |
|
Push the config to the EFI. |
|
Print EFI boot entries. |
|
Get or set the EFI boot timeout. |
Command Utilities
A decorator for CLI command functions. |
|
Get the set of all commands. |