File: complete.py

package info (click to toggle)
pdm 2.20.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,988 kB
  • sloc: python: 24,413; javascript: 34; makefile: 11
file content (20 lines) | stat: -rw-r--r-- 414 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from pathlib import Path

import pycomplete

from pdm.core import Core

COMPLETIONS = Path(__file__).parent.parent / "src/pdm/cli/completions"


def main():
    core = Core()
    core.init_parser()

    completer = pycomplete.Completer(core.parser, ["pdm"])
    for shell in ("bash", "fish"):
        COMPLETIONS.joinpath(f"pdm.{shell}").write_text(completer.render(shell))


if __name__ == "__main__":
    main()