Skip to content

Commit

Permalink
Should work on bash. Experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Apr 9, 2017
1 parent e73d75f commit c2b0958
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;;
Expand All @@ -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
2 changes: 2 additions & 0 deletions cmd/yay/yay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit c2b0958

Please sign in to comment.