File: epilog.py

package info (click to toggle)
ansible-core 2.14.18-0%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,072 kB
  • sloc: python: 172,173; cs: 4,367; sh: 3,898; makefile: 41; xml: 34
file content (23 lines) | stat: -rw-r--r-- 658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Argument parsing epilog generation."""
from __future__ import annotations

from .argparsing import (
    CompositeActionCompletionFinder,
)

from ..data import (
    data_context,
)


def get_epilog(completer: CompositeActionCompletionFinder) -> str:
    """Generate and return the epilog to use for help output."""
    if completer.enabled:
        epilog = 'Tab completion available using the "argcomplete" python package.'
    else:
        epilog = 'Install the "argcomplete" python package to enable tab completion.'

    if data_context().content.unsupported:
        epilog += '\n\n' + data_context().explain_working_directory()

    return epilog