Skip to content

top ¤

Command to run the text user-interface.

Functions:

  • top

    Top subcommand.

top ¤

top(api: API) -> int

Top subcommand.

Parameters:

  • api (API) –

    The API instance to use.

Returns:

  • int ( int ) –

    Always 0.

Source code in src/aria2p/cli/commands/top.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def top(api: API) -> int:
    """Top subcommand.

    Parameters:
        api: The API instance to use.

    Returns:
        int: Always 0.
    """
    if Interface is None:
        print(
            "The top-interface dependencies are not installed. Try running `pip install aria2p[tui]` to install them.",
            file=sys.stderr,
        )
        return 1

    interface = Interface(api)
    success = interface.run()
    return 0 if success else 1