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