@@ -40,39 +40,95 @@ Enable Autocomplete
40
40
Z Shell
41
41
~~~~~~~
42
42
43
- If you use ``zsh`` to run the {+mcli+}, add the following to your
44
- ``~/.zshrc`` :
45
-
43
+ If you use ``zsh`` to run the {+mcli+}, run the following command
44
+ to enable autocomplete in your current shell :
45
+
46
46
.. code-block:: sh
47
+
48
+ % echo "autoload -U compinit; compinit" >> ~/.zshrc
47
49
48
- autoload -Uz compinit
49
- compinit
50
-
51
- source <(mongocli completion zsh)
52
- compdef _mongocli mongocli
53
-
54
- Run the following command to reload your ``zsh`` profile:
50
+ To enable autocomplete for all future shell sessions:
51
+
52
+ 1.
53
+
54
+ - If you use MacOS, run the following command:
55
+
56
+ .. code-block:: sh
57
+
58
+ % mongocli completion zsh > /usr/local/share/zsh/site-functions/_mongocli
59
+
60
+ - If you use Linux, run the following command:
61
+
62
+ .. code-block:: sh
63
+
64
+ % mongocli completion zsh > "${fpath[1]}/_mongocli"
65
+
66
+ #. Start a new shell for the setup to take effect.
67
+
68
+ Bash
69
+ ~~~~
55
70
71
+ If you use Bash to run the {+mcli+}, install the ``bash-completion``
72
+ package via your OS's package manager. Then,
73
+ run the following command to enable autocomplete in your current shell:
74
+
56
75
.. code-block:: sh
76
+
77
+ $ source <(mongocli completion bash)
57
78
58
- source ~/.zshrc
79
+ To enable autocomplete for all future shell sessions:
59
80
60
- Bash
81
+ 1.
82
+
83
+ - If you use MacOS, run the following command:
84
+
85
+ .. code-block:: sh
86
+
87
+ $ mongocli completion bash > /usr/local/etc/bash_completion.d/mongocli
88
+
89
+ - If you use Linux, run the following command:
90
+
91
+ .. code-block:: sh
92
+
93
+ $ mongocli completion bash > /etc/bash_completion.d/mongocli
94
+
95
+ #. Start a new shell for the setup to take effect.
96
+
97
+ Fish
61
98
~~~~
62
-
63
- If you use Bash to run the {+mcli+}, add the following to your
64
- ``~/.bash_profile`` :
99
+
100
+ If you use ``fish`` to run the {+mcli+}, run the following command
101
+ to enable autocomplete in your current shell :
65
102
66
103
.. code-block:: sh
104
+
105
+ > mongocli completion fish | source
106
+
107
+ To enable autocomplete for all future shell sessions:
108
+
109
+ 1. Run the following command:
110
+
111
+ .. code-block:: sh
112
+
113
+ > mongocli completion fish > ~/.config/fish/completions/mongocli.fish
67
114
68
- eval "$(mongocli completion bash)"
115
+ #. Start a new shell for the setup to take effect.
116
+
117
+ PowerShell
118
+ ~~~~~~~~~~
69
119
70
- Run the following command to reload your Bash profile:
120
+ If you use PowerShell to run the {+mcli+}, run the following command
121
+ to enable autocomplete in your current shell:
71
122
72
123
.. code-block:: sh
73
124
74
- source ~/.bash_profile
125
+ PS C:\> mongocli completion powershell | Out-String | Invoke-Expression
75
126
127
+ To enable autocomplete for all future shells, add the output
128
+ of the above command to your PowerShell profile. To learn how
129
+ to edit a PowerShell profile, see `Windows Documentation
130
+ <https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/ise/how-to-use-profiles-in-windows-powershell-ise?view=powershell-7.1>`__.
131
+
76
132
Use ``Tab`` to Autocomplete Commands
77
133
------------------------------------
78
134
0 commit comments