Fixes no confirms

This commit is contained in:
Jguer 2017-08-02 22:56:45 +01:00
parent 5ad1772bba
commit 262b158a34
2 changed files with 30 additions and 24 deletions

View file

@ -31,11 +31,15 @@ Yay was created with a few objectives in mind and based on the design of yaourt
- `yay -Cd` cleans unneeded dependencies - `yay -Cd` cleans unneeded dependencies
- `yay -G` downloads PKGBuild from ABS or AUR - `yay -G` downloads PKGBuild from ABS or AUR
![Yay Syu](http://jguer.github.io/yay/yayupgrade.png "yay -Syu")
![Yay Qstats](http://jguer.github.io/yay/yay2.png "yay -Qstats") ![Yay Qstats](http://jguer.github.io/yay/yay2.png "yay -Qstats")
![Yay NumberMenu](http://jguer.github.io/yay/yay3.png "yay gtk-theme") ![Yay NumberMenu](http://jguer.github.io/yay/yay3.png "yay gtk-theme")
### Changelog ### Changelog
#### 2.165
- Upgrade list now allows skipping upgrade install.
#### 2.159 #### 2.159
- Qstats now warns about packages not available in AUR. - Qstats now warns about packages not available in AUR.
@ -45,7 +49,6 @@ Yay was created with a few objectives in mind and based on the design of yaourt
- Pacman backend rewritten and simplified - Pacman backend rewritten and simplified
- Added config framework. - Added config framework.
#### 1.115 #### 1.115
- Added AUR completions (updates on first completion every 48h) - Added AUR completions (updates on first completion every 48h)

View file

@ -292,10 +292,14 @@ func upgradePkgs(flags []string) error {
return err return err
} }
var repoNums []int
var aurNums []int
sort.Sort(repoUp) sort.Sort(repoUp)
fmt.Printf("\x1b[1;34;1m:: \x1b[0m\x1b[1m%d Packages to upgrade.\x1b[0m\n", len(aurUp)+len(repoUp)) fmt.Printf("\x1b[1;34;1m:: \x1b[0m\x1b[1m%d Packages to upgrade.\x1b[0m\n", len(aurUp)+len(repoUp))
repoUp.Print(len(aurUp)) repoUp.Print(len(aurUp))
aurUp.Print(0) aurUp.Print(0)
if !config.YayConf.NoConfirm {
fmt.Print("\x1b[32mEnter packages you don't want to upgrade.\x1b[0m\nNumbers: ") fmt.Print("\x1b[32mEnter packages you don't want to upgrade.\x1b[0m\nNumbers: ")
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
@ -306,8 +310,6 @@ func upgradePkgs(flags []string) error {
} }
result := strings.Fields(string(numberBuf)) result := strings.Fields(string(numberBuf))
var repoNums []int
var aurNums []int
for _, numS := range result { for _, numS := range result {
num, err := strconv.Atoi(numS) num, err := strconv.Atoi(numS)
if err != nil { if err != nil {
@ -323,6 +325,7 @@ func upgradePkgs(flags []string) error {
repoNums = append(repoNums, num) repoNums = append(repoNums, num)
} }
} }
}
if len(repoUp) != 0 { if len(repoUp) != 0 {
var repoNames []string var repoNames []string
@ -336,7 +339,7 @@ func upgradePkgs(flags []string) error {
repoNames = append(repoNames, k.Name) repoNames = append(repoNames, k.Name)
} }
err := config.PassToPacman("-S", repoNames, flags) err := config.PassToPacman("-S", repoNames, append(flags, "--noconfirm"))
if err != nil { if err != nil {
fmt.Println("Error upgrading repo packages.") fmt.Println("Error upgrading repo packages.")
} }