Revert remove command, too easy to remove all packages
Signed-off-by: jolheiser <john.olheiser@gmail.com>pull/7/head
parent
cb0dd34973
commit
2220ab17eb
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue