Should work on bash. Experimental

This commit is contained in:
Jguer 2017-04-09 23:00:04 +01:00
parent e73d75fc37
commit c2b0958ccb
3 changed files with 10 additions and 5 deletions

View file

@ -339,10 +339,13 @@ func Complete() (err error) {
if err != nil {
return err
}
defer out.Close()
aur.CreateAURList(out)
if aur.CreateAURList(out) != nil {
defer os.Remove(path)
}
err = pac.CreatePackageList(out)
out.Close()
return err
}

View file

@ -50,7 +50,7 @@ _pacman_pkg() {
)"
}
_pacman() {
_yay() {
local common core cur database prev query remove sync upgrade o
COMPREPLY=()
_get_comp_words_by_ref cur prev
@ -90,7 +90,7 @@ _pacman() {
_pacman_pkg Qq;;
S)
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
{ _arch_incomp 'l list' && _pacman_pkg Sl sort; } ||
{ _arch_incomp 'l list' && $(yay --complete bash); } ||
_pacman_pkg Slq;;
U)
_pacman_file;;
@ -103,6 +103,6 @@ _pacman_file() {
compopt -o filenames; _filedir 'pkg.tar*'
}
complete -F _pacman -o default yay
complete -F _yay -o default yay
# ex:et ts=2 sw=2 ft=sh

View file

@ -63,6 +63,8 @@ func parser() (op string, options []string, packages []string, err error) {
util.SortMode = util.TopDown
case "--complete":
util.Shell = os.Args[i+1]
fmt.Println(util.Shell)
os.Exit(0)
yay.Complete()
os.Exit(0)
case "--help":