Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/openai/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
from ._cli import main as main
# openai/cli/main.py
import click

@click.group()
def cli():
"""OpenAI CLI — interact with the API from your terminal."""
pass

@cli.command()
@click.option("--shell", type=click.Choice(["bash", "zsh", "fish", "powershell"]), help="Shell type.")
def install_completion(shell):
"""
Install auto-completion for the OpenAI CLI.
"""
click.echo(f"To enable completion for {shell}, run:")
if shell == "bash":
click.echo('eval "$(_OPENAI_COMPLETE=bash_source openai)"')
elif shell == "zsh":
click.echo('eval "$(_OPENAI_COMPLETE=zsh_source openai)"')
elif shell == "fish":
click.echo('eval (env _OPENAI_COMPLETE=fish_source openai)')
elif shell == "powershell":
click.echo('Invoke-Expression -Command $(_OPENAI_COMPLETE=powershell_source openai)')
else:
click.echo("Unsupported shell. Use one of: bash, zsh, fish, powershell.")