File: gen-ac-index

package info (click to toggle)
awscli 2.31.35-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 156,692 kB
  • sloc: python: 213,816; xml: 14,082; makefile: 189; sh: 178; javascript: 8
file content (34 lines) | stat: -rwxr-xr-x 923 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
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""Generate the index used for the new auto-completion."""

import argparse
import os

from awscli.autocomplete import db, generator


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--include-builtin-index',
        action='store_true',
        help=("Also generate builtin index as well as the INDEX_LOCATION."),
    )
    parser.add_argument(
        '--index-location',
        default=db.INDEX_FILE,
        help=(
            f'Location to write the index file. Defaults to {db.INDEX_FILE}'
        ),
    )
    args = parser.parse_args()
    index_dir = os.path.dirname(os.path.abspath(args.index_location))
    if not os.path.isdir(index_dir):
        os.makedirs(index_dir)
    generator.generate_index(args.index_location)
    if args.include_builtin_index:
        generator.generate_index(db.BUILTIN_INDEX_FILE)


if __name__ == '__main__':
    main()