turned completion subcommand into option

This commit is contained in:
2022-11-01 11:40:36 +01:00
parent 8552270a68
commit 335b2665f2
4 changed files with 75 additions and 52 deletions

View File

@@ -31,6 +31,7 @@ tablizer - Manipulate tabular output of other programs
-t, --sort-time sort according to time string
Other Flags:
--completion <shell> Generate the autocompletion script for <shell>
-d, --debug Enable debugging
-h, --help help for tablizer
-m, --man Display manual page
@@ -229,19 +230,25 @@ precedence over environment variables.
=head2 COMPLETION
Shell completion for command line options can be enabled by using the
B<--completion> flag. The required parameter is the name of your
shell. Currently supported are: bash, zsh, fish and powershell.
Detailed instructions:
=over
=item Bash:
source <(%[1]s completion bash)
source <(tablizer --completion bash)
To load completions for each session, execute once:
# Linux:
$ tablizer completion bash > /etc/bash_completion.d/%[1]s
$ tablizer --completion bash > /etc/bash_completion.d/tablizer
# macOS:
$ tablizer completion bash > $(brew --prefix)/etc/bash_completion.d/%[1]s
$ tablizer --completion bash > $(brew --prefix)/etc/bash_completion.d/tablizer
=item Zsh:
@@ -252,25 +259,25 @@ you will need to enable it. You can execute the following once:
To load completions for each session, execute once:
$ tablizer completion zsh > "${fpath[1]}/_%[1]s"
$ tablizer --completion zsh > "${fpath[1]}/_tablizer"
You will need to start a new shell for this setup to take effect.
=item fish:
tablizer completion fish | source
tablizer --completion fish | source
To load completions for each session, execute once:
tablizer completion fish > ~/.config/fish/completions/%[1]s.fish
tablizer --completion fish > ~/.config/fish/completions/tablizer.fish
=item PowerShell:
tablizer completion powershell | Out-String | Invoke-Expression
tablizer --completion powershell | Out-String | Invoke-Expression
To load completions for every new session, run:
tablizer completion powershell > tablizer.ps1
tablizer --completion powershell > tablizer.ps1
and source this file from your PowerShell profile.