You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`-p, --profile <profile>`|Path to the PowerShell profile file
17
+
`--query [query]`|JMESPath query string. See [http://jmespath.org/](http://jmespath.org/) for more information and examples
This commands sets up command completion for the Office 365 CLI in PowerShell by registering a custom PowerShell argument completer in the specified profile. Because Office 365 CLI is not a native PowerShell module, it requires a custom completer to provide completion when used in non-immersive mode.
25
+
26
+
If the specified profile path doesn't exist, the CLI will try to create it.
27
+
28
+
## Examples
29
+
30
+
Set up command completion for PowerShell using the profile from the profile
`--query [query]`|JMESPath query string. See [http://jmespath.org/](http://jmespath.org/) for more information and examples
This commands updates the list of commands and their options used by command completion in PowerShell. You should run this command each time after upgrading the Office 365 CLI.
24
+
25
+
## Examples
26
+
27
+
Update list of commands for PowerShell command completion
Copy file name to clipboardExpand all lines: docs/manual/docs/concepts/completion.md
+28-6Lines changed: 28 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,14 @@ To enable completion:
25
25
26
26
You should now be able to complete your input, eg. typing `o365 s<tab>` will complete it to `o365 spo` and typing `o365 spo <tab><tab>` will list all SharePoint Online commands available in Office 365 CLI. To see the options available for the current command, type `-<tab><tab>`, for example `o365 spo app list -<tab><tab>` will list all options available for the `o365 spo app list` command.
27
27
28
-
#### Disable Clink completion
29
-
30
-
To disable completion, delete the `o365.lua` file you generated previously and restart your shell.
31
-
32
28
#### Update Clink completion
33
29
34
30
Command completion is based on a static file. After updating the Office 365 CLI, you should update the completion file as described in the [Enable completion](#enable-clink-completion) section so that the completion file reflects the latest commands in the Office 365 CLI.
35
31
32
+
#### Disable Clink completion
33
+
34
+
To disable completion, delete the `o365.lua` file you generated previously and restart your shell.
35
+
36
36
### Zsh, Bash and Fish
37
37
38
38
If you're using Zsh, Bash or Fish as your shell, you can benefit of Office 365 CLI command completion as well, when typing commands directly in the shell. The completion is based on the [Omelette](https://www.npmjs.com/package/omelette) package.
@@ -49,6 +49,10 @@ To enable completion:
49
49
50
50
You should now be able to complete your input, eg. typing `o365 s<tab>` will complete it to `o365 spo` and typing `o365 spo <tab><tab>` will list all SharePoint Online commands available in Office 365 CLI. To see the options available for the command, type `-<tab><tab>`, for example `o365 spo app list -<tab><tab>` will list all options available for the `o365 spo app list` command. If the command is completed, the completion will automatically start suggestions with a `-` indicating that you have matched a command and can now specify its options. Command options you've already used are removed from the suggestions list, but the completion doesn't take into account short and long variant of the same option. If you specified the `--output` option in your command, `--option` will not be displayed in the list of suggestions, but `-o` will.
51
51
52
+
#### Update sh completion
53
+
54
+
Command completion is based on the static `commands.json` file located in the folder where the Office 365 CLI is installed. After updating the Office 365 CLI, you should update the completion file by executing `o365 --completion:sh:generate` in the command line. After running this command, it's not necessary to restart the shell to see the latest changes.
55
+
52
56
#### Disable sh completion
53
57
54
58
To disable completion, edit your shell's profile file (for Zsh `~/.zshrc`) and remove the following lines:
@@ -61,6 +65,24 @@ To disable completion, edit your shell's profile file (for Zsh `~/.zshrc`) and r
61
65
62
66
Save the profile file and restart the shell for the changes to take effect.
63
67
64
-
#### Update sh completion
68
+
###PowerShell
65
69
66
-
Command completion is based on the static `commands.json` file located in the folder where the Office 365 CLI is installed. After updating the Office 365 CLI, you should update the completion file by executing `o365 --completion:sh:generate` in the command line. After running this command, it's not necessary to restart the shell to see the latest changes.
70
+
If you use Office 365 CLI in PowerShell you can use the custom argument completer provided with the Office 365 CLI to get command completion when typing commands directly in the shell.
71
+
72
+
#### Enable PowerShell completion
73
+
74
+
To enable completion in your current PowerShell profile:
75
+
76
+
1. Start PowerShell
77
+
1. Execute `o365 cli completion pwsh setup --profile $profile`. This will generate the `commands.json` file in the same folder where the Office 365 CLI is installed, listing all available commands and their options. Additionally, it will register completion in your PowerShell profile
78
+
1. Restart PowerShell
79
+
80
+
You should now be able to complete your input, eg. typing `o365 s<tab>` will complete it to `o365 spo` and typing `o365 spo <tab><tab>` will list all SharePoint Online commands available in Office 365 CLI. To see the options available for the command, type `-<tab><tab>`, for example `o365 spo app list -<tab><tab>` will list all options available for the `o365 spo app list` command. If the command is completed, the completion will automatically start suggestions with a `-` indicating that you have matched a command and can now specify its options. Command options you've already used are removed from the suggestions list, but the completion doesn't take into account short and long variant of the same option. If you specified the `--output` option in your command, `--option` will not be displayed in the list of suggestions, but `-o` will.
81
+
82
+
#### Update PowerShell completion
83
+
84
+
Command completion is based on the static `commands.json` file located in the folder where the Office 365 CLI is installed. After updating the Office 365 CLI, you should update the completion file by executing `o365 cli completion pwsh update` in the command line. After running this command, it's not necessary to restart PowerShell to see the latest changes.
85
+
86
+
#### Disable PowerShell completion
87
+
88
+
To disable Office 365 CLI command completion in your PowerShell profile, open the profile file in a code editor, and remove the reference to the `Register-O365CLICompletion.ps1` script. Restart PowerShell for the changes to take effect.
0 commit comments