Revert remove command, too easy to remove all packages

Signed-off-by: jolheiser <john.olheiser@gmail.com>
pull/7/head
jolheiser 2021-02-27 22:45:39 -06:00
parent cb0dd34973
commit 2220ab17eb
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
3 changed files with 25 additions and 26 deletions

View File

@ -3,11 +3,11 @@ package cmd
import (
"context"
"errors"
"go.jolheiser.com/gpm/database"
"os"
"path/filepath"
"go.jolheiser.com/gpm/cmd/flags"
"go.jolheiser.com/gpm/database"
"go.jolheiser.com/gpm/go-gpm"
"go.jolheiser.com/gpm/router"

View File

@ -2,7 +2,6 @@ package cmd
import (
"context"
"go.jolheiser.com/beaver"
"go.jolheiser.com/gpm/cmd/flags"
"go.jolheiser.com/gpm/database"
@ -10,6 +9,7 @@ import (
"github.com/AlecAivazis/survey/v2"
"github.com/urfave/cli/v2"
"go.jolheiser.com/beaver"
)
var Remove = cli.Command{
@ -33,17 +33,16 @@ func doRemove(_ *cli.Context) error {
pkgMap[pkg.Name] = pkg
}
pkgQuestion := &survey.MultiSelect{
pkgQuestion := &survey.Select{
Message: "Select package to remove",
Options: pkgSlice,
}
var pkgNames []string
if err := survey.AskOne(pkgQuestion, &pkgNames); err != nil {
var pkgName string
if err := survey.AskOne(pkgQuestion, &pkgName); err != nil {
return err
}
for _, pkgName := range pkgNames {
pkg := gpm.Package{
Name: pkgName,
Import: pkgMap[pkgName].Import,
@ -63,8 +62,7 @@ func doRemove(_ *cli.Context) error {
return err
}
}
beaver.Infof("Removed %s", yellow.Format(pkgName))
}
beaver.Infof("Removed %s", yellow.Format(pkgName))
return nil
}

View File

@ -2,6 +2,7 @@ package cmd
import (
"context"
"go.jolheiser.com/gpm/cmd/flags"
"go.jolheiser.com/gpm/database"
"go.jolheiser.com/gpm/go-gpm"