Skip to content

Commit

Permalink
feat: delete sourcee will use preset alias
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jun 16, 2023
1 parent 153d431 commit 71b2f16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions internal/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ func (action *actionImpl) Drop() int {
})
return 1
}
// Set npm as default choose
ok := action.conf.SetCurrentPath(source.DefaultKey[source.Npm])
if ok {
err := action.fs.OuputFile(action.conf.ConfPath, []byte(action.conf.GetCurrentConf()))
if err != nil {
logger.PrintTextWithColor(os.Stderr, func(c logger.Colors) string {
return fmt.Sprintf("%s%s%s\n", c.Red, err, c.Reset)
})
return 1
}
}
logger.PrintTextWithColor(os.Stdout, func(c logger.Colors) string {
return fmt.Sprintf("%s%s%s\n", c.Green, "remove registry success", c.Reset)
})
Expand Down
6 changes: 5 additions & 1 deletion internal/source/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ func NewGrmConf() *GrmConfig {
func (g *GrmConfig) ListAllPath() {
aliases, files := g.scanner()
list := make([]string, 0, len(aliases)+len(SourceToString))
list = append(list, SourceToString...)
for _, s := range SourceToString {
if s != System.String() {
list = append(list, s)
}
}
list = append(list, aliases...)
g.files = files
g.aliases = aliases
Expand Down

0 comments on commit 71b2f16

Please sign in to comment.