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

main

Efiboot is a tool for managing EFI boot entries.

Commands

bootnext

Get or set the entry to boot into next.

push

Push the config to the EFI.

status

Print EFI boot entries.

timeout

Get or set the EFI boot timeout.

Command Utilities

command

A decorator for CLI command functions.

all_commands

Get the set of all commands.