-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path26-completion.sh
More file actions
executable file
·50 lines (42 loc) · 1.35 KB
/
26-completion.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.35 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Example 26: Shell Completions
# Demonstrates generating shell completion scripts for bash, zsh, and fish
set -e
echo "=== DeepL CLI Example 26: Shell Completions ==="
echo
echo "1. Generate bash completion (preview):"
deepl completion bash | head -5
echo " ..."
echo
echo "2. Generate zsh completion (preview):"
deepl completion zsh | head -5
echo " ..."
echo
echo "3. Generate fish completion (preview):"
deepl completion fish | head -5
echo " ..."
echo
echo "4. Direct sourcing (for testing in current session):"
echo " Bash: source <(deepl completion bash)"
echo ' Zsh: eval "$(deepl completion zsh)"'
echo " Fish: deepl completion fish | source"
echo
echo "5. Permanent installation:"
echo " Bash:"
echo " deepl completion bash > /etc/bash_completion.d/deepl"
echo " # Or for user-level:"
echo " deepl completion bash > ~/.local/share/bash-completion/completions/deepl"
echo
echo " Zsh:"
echo ' deepl completion zsh > "${fpath[1]}/_deepl"'
echo " # Then add to .zshrc: autoload -Uz compinit && compinit"
echo
echo " Fish:"
echo " deepl completion fish > ~/.config/fish/completions/deepl.fish"
echo
echo "=== Shell Completions Examples Complete ==="
echo
echo "Tips:"
echo " - Completions cover all commands, subcommands, and flags"
echo " - Regenerate after upgrading deepl-cli"
echo " - Works without an API key"