awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.15k stars 769 forks source link

Proactively creating autocomplete index #272

Open avishay28 opened 5 months ago

avishay28 commented 5 months ago

Is there a way to proactively index the autocomplete docs, without waiting for user to run aws-shell command? I want to run it in advnace during startup, so when user will access the shell the files will already be ready in .aws/shell/cache, so the user won't need to wait. I coudn't find a way to do it, trying to run aws-shell command in non-interactive context (for example during ducker build) results in error

First run, creating autocomplete index...
Creating doc index in the background. It will be a few minutes before all documentation is available.
Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/awsshell/__init__.py", line 70, in main
    shell.run()
  File "/usr/local/lib/python3.10/dist-packages/awsshell/app.py", line 292, in run
    document = self.cli.run(reset_current_buffer=True)
  File "/usr/local/lib/python3.10/dist-packages/awsshell/app.py", line 285, in cli
    self._cli = self.create_cli_interface(self.show_completion_columns)
  File "/usr/local/lib/python3.10/dist-packages/awsshell/app.py", line 486, in create_cli_interface
    cli = CommandLineInterface(application=app, eventloop=loop,
  File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/interface.py", line 80, in __init__
    self.output = output or create_output()
  File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/shortcuts.py", line 124, in create_output
    return Vt100_Output.from_pty(
  File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/terminal/vt100_output.py", line 424, in from_pty
    assert stdout.isatty()
AssertionError