forked from Plemya-x/ALR
		
	Merge pull request 'fix install bash completion' (#63) from Maks1mS/ALR:fix-install-bash-complete into master
Reviewed-on: Plemya-x/ALR#63
This commit is contained in:
		
							
								
								
									
										40
									
								
								e2e-tests/bash_completion_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								e2e-tests/bash_completion_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					// ALR - Any Linux Repository
 | 
				
			||||||
 | 
					// Copyright (C) 2025 Евгений Храмов
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 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/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build e2e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package e2etests_test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/alecthomas/assert/v2"
 | 
				
			||||||
 | 
						"github.com/efficientgo/e2e"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestE2EBashCompletion(t *testing.T) {
 | 
				
			||||||
 | 
						dockerMultipleRun(
 | 
				
			||||||
 | 
							t,
 | 
				
			||||||
 | 
							"bash-completion",
 | 
				
			||||||
 | 
							COMMON_SYSTEMS,
 | 
				
			||||||
 | 
							func(t *testing.T, r e2e.Runnable) {
 | 
				
			||||||
 | 
								err := r.Exec(e2e.NewCommand(
 | 
				
			||||||
 | 
									"alr", "install", "--generate-bash-completion",
 | 
				
			||||||
 | 
								))
 | 
				
			||||||
 | 
								assert.NoError(t, err)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -124,8 +124,14 @@ func InstallCmd() *cli.Command {
 | 
				
			|||||||
		},
 | 
							},
 | 
				
			||||||
		BashComplete: func(c *cli.Context) {
 | 
							BashComplete: func(c *cli.Context) {
 | 
				
			||||||
			cfg := config.New()
 | 
								cfg := config.New()
 | 
				
			||||||
 | 
								err := cfg.Load()
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									slog.Error(gotext.Get("Error loading config"), "err", err)
 | 
				
			||||||
 | 
									os.Exit(1)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			db := database.New(cfg)
 | 
								db := database.New(cfg)
 | 
				
			||||||
			err := db.Init(c.Context)
 | 
								err = db.Init(c.Context)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				slog.Error(gotext.Get("Error initialization database"), "err", err)
 | 
									slog.Error(gotext.Get("Error initialization database"), "err", err)
 | 
				
			||||||
				os.Exit(1)
 | 
									os.Exit(1)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -162,15 +162,15 @@ msgstr ""
 | 
				
			|||||||
msgid "Command install expected at least 1 argument, got %d"
 | 
					msgid "Command install expected at least 1 argument, got %d"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:157
 | 
					#: install.go:163
 | 
				
			||||||
msgid "Remove an installed package"
 | 
					msgid "Remove an installed package"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:162
 | 
					#: install.go:168
 | 
				
			||||||
msgid "Command remove expected at least 1 argument, got %d"
 | 
					msgid "Command remove expected at least 1 argument, got %d"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:177
 | 
					#: install.go:183
 | 
				
			||||||
msgid "Error removing packages"
 | 
					msgid "Error removing packages"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -170,15 +170,15 @@ msgstr "Установить новый пакет"
 | 
				
			|||||||
msgid "Command install expected at least 1 argument, got %d"
 | 
					msgid "Command install expected at least 1 argument, got %d"
 | 
				
			||||||
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
 | 
					msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:157
 | 
					#: install.go:163
 | 
				
			||||||
msgid "Remove an installed package"
 | 
					msgid "Remove an installed package"
 | 
				
			||||||
msgstr "Удалить установленный пакет"
 | 
					msgstr "Удалить установленный пакет"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:162
 | 
					#: install.go:168
 | 
				
			||||||
msgid "Command remove expected at least 1 argument, got %d"
 | 
					msgid "Command remove expected at least 1 argument, got %d"
 | 
				
			||||||
msgstr "Для команды remove ожидался хотя бы 1 аргумент, получено %d"
 | 
					msgstr "Для команды remove ожидался хотя бы 1 аргумент, получено %d"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: install.go:177
 | 
					#: install.go:183
 | 
				
			||||||
msgid "Error removing packages"
 | 
					msgid "Error removing packages"
 | 
				
			||||||
msgstr "Ошибка при удалении пакетов"
 | 
					msgstr "Ошибка при удалении пакетов"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user