Home

Awesome

complete-alias

automagical shell alias completion;

install

  1. install dependency bash-completion;

    • linux:

      install bash-completion using system package manager:

      dnf install bash-completion     ##  fedora
      apt install bash-completion     ##  debian
      

      for other linux distros, see faq;

    • macos (experimental):

      install bash-completion homebrew formulae version 2:

      brew install bash-completion@2
      
    • windows (experimental):

      see faq;

  2. source complete_alias in ~/.bash_completion:

    . {complete_alias}
    

    where {complete_alias} is the path of complete_alias;

usage

  1. edit aliases to complete in complete_alias:

    for example, to complete aliases foo, bar and baz:

    complete -F _complete_alias foo
    complete -F _complete_alias bar
    complete -F _complete_alias baz
    
  2. to complete an alias, type it and press <tab>;

example

to complete alias sctl aliased to systemctl:

$ alias sctl='systemctl'
$ cp complete_alias ~/.complete_alias
$ echo ". ~/.complete_alias" >> ~/.bash_completion
$ echo "complete -F _complete_alias sctl" >> ~/.complete_alias
$ sctl <tab>
add-requires
add-wants
cancel
cat
condreload
...

config

to config complete-alias, set these envars before sourcing the main script:

compat

faq

license

The source code is licensed under the GNU General Public License v3.0.

Copyright (C) 2016-2021 Cyker Way

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.