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()
|