mirror of
https://github.com/jimeh/evm.git
synced 2026-02-19 07:26:40 +00:00
refactor: extract core logic to a plain Go package
This commit is contained in:
48
commands/evm.go
Normal file
48
commands/evm.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/jimeh/evm/manager"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewEvm(mgr *manager.Manager) (*cobra.Command, error) {
|
||||
cmd := &cobra.Command{
|
||||
Use: "evm",
|
||||
Short: "A simple and opinionated Emacs Version Manager and build tool",
|
||||
}
|
||||
|
||||
configCmd, err := NewConfig(mgr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
listCmd, err := NewList(mgr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
useCmd, err := NewUse(mgr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rehashCmd, err := NewRehash(mgr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
execCmd, err := NewExec(mgr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd.AddCommand(
|
||||
configCmd,
|
||||
listCmd,
|
||||
useCmd,
|
||||
rehashCmd,
|
||||
execCmd,
|
||||
)
|
||||
|
||||
return cmd, nil
|
||||
}
|
||||
Reference in New Issue
Block a user