fix: add interactive=false handling in remove command #60
40
e2e-tests/issue_32_interactive_test.go
Normal file
40
e2e-tests/issue_32_interactive_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 TestE2EIssue32Interactive(t *testing.T) {
|
||||||
|
dockerMultipleRun(
|
||||||
|
t,
|
||||||
|
"issue-32-interactive",
|
||||||
|
COMMON_SYSTEMS,
|
||||||
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
|
err := r.Exec(e2e.NewCommand(
|
||||||
|
"alr", "--interactive=false", "remove", "ca-certificates",
|
||||||
|
))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
@ -169,7 +169,10 @@ func RemoveCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := mgr.Remove(nil, c.Args().Slice()...)
|
err := mgr.Remove(&manager.Opts{
|
||||||
|
AsRoot: true,
|
||||||
|
NoConfirm: !c.Bool("interactive"),
|
||||||
|
}, c.Args().Slice()...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error removing packages"), "err", err)
|
slog.Error(gotext.Get("Error removing packages"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -170,7 +170,7 @@ msgstr ""
|
|||||||
msgid "Command remove expected at least 1 argument, got %d"
|
msgid "Command remove expected at least 1 argument, got %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: install.go:174
|
#: install.go:177
|
||||||
msgid "Error removing packages"
|
msgid "Error removing packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ msgstr "Удалить установленный пакет"
|
|||||||
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:174
|
#: install.go:177
|
||||||
msgid "Error removing packages"
|
msgid "Error removing packages"
|
||||||
msgstr "Ошибка при удалении пакетов"
|
msgstr "Ошибка при удалении пакетов"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user