mirror of
https://github.com/casey/just
synced 2024-09-06 00:39:13 +00:00
Make completions work with Bash alias (#1035)
This commit is contained in:
parent
762c461780
commit
f70b6711a2
|
@ -1750,6 +1750,12 @@ Tools that pair nicely with `just` include:
|
||||||
|
|
||||||
For lightning-fast command running, put `alias j=just` in your shell's configuration file.
|
For lightning-fast command running, put `alias j=just` in your shell's configuration file.
|
||||||
|
|
||||||
|
In `bash`, the aliased command may not keep the shell completion functionality described in the next section. Add the following line to your `.bashrc` to use the same completion function as `just` for your aliased command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
complete -F _just -o bashdefault -o default j
|
||||||
|
```
|
||||||
|
|
||||||
=== Shell Completion Scripts
|
=== Shell Completion Scripts
|
||||||
|
|
||||||
Shell completion scripts for Bash, Zsh, Fish, PowerShell, and Elvish are available in the link:completions[] directory. Please refer to your shell's documentation for how to install them.
|
Shell completion scripts for Bash, Zsh, Fish, PowerShell, and Elvish are available in the link:completions[] directory. Please refer to your shell's documentation for how to install them.
|
||||||
|
|
|
@ -9,7 +9,7 @@ _just() {
|
||||||
for i in ${COMP_WORDS[@]}
|
for i in ${COMP_WORDS[@]}
|
||||||
do
|
do
|
||||||
case "${i}" in
|
case "${i}" in
|
||||||
just)
|
"$1")
|
||||||
cmd="just"
|
cmd="just"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,8 @@ pub(crate) const POWERSHELL_COMPLETION_REPLACEMENTS: &[(&str, &str)] = &[(
|
||||||
Sort-Object -Property ListItemText"#,
|
Sort-Object -Property ListItemText"#,
|
||||||
)];
|
)];
|
||||||
|
|
||||||
pub(crate) const BASH_COMPLETION_REPLACEMENTS: &[(&str, &str)] = &[(
|
pub(crate) const BASH_COMPLETION_REPLACEMENTS: &[(&str, &str)] = &[
|
||||||
|
(
|
||||||
r#" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
r#" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||||
return 0
|
return 0
|
||||||
|
@ -171,4 +172,6 @@ pub(crate) const BASH_COMPLETION_REPLACEMENTS: &[(&str, &str)] = &[(
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi"#,
|
fi"#,
|
||||||
)];
|
),
|
||||||
|
(r#" just)"#, r#" "$1")"#),
|
||||||
|
];
|
||||||
|
|
Loading…
Reference in a new issue