feat: remove config path completly
parent
5083abaa9b
commit
8f96806ebf
|
@ -12,9 +12,6 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
// Read when run
|
||||
Path string `json:"-"`
|
||||
|
||||
// Read from file
|
||||
Apps map[string]App `json:"apps"`
|
||||
}
|
||||
|
@ -53,7 +50,6 @@ func LoadConfig(path string) (result Config, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
result.Path = configPath
|
||||
return
|
||||
}
|
||||
|
||||
|
|
12
main.go
12
main.go
|
@ -13,6 +13,8 @@ const (
|
|||
|
||||
installCommand = "install"
|
||||
updateCommand = "update"
|
||||
|
||||
curentDir = "."
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -46,11 +48,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
type action struct {
|
||||
flags struct {
|
||||
path string
|
||||
}
|
||||
}
|
||||
type action struct{}
|
||||
|
||||
// Show help by default
|
||||
func (a *action) Run(c *cli.Context) error {
|
||||
|
@ -58,7 +56,7 @@ func (a *action) Run(c *cli.Context) error {
|
|||
}
|
||||
|
||||
func (a *action) RunInstall(c *cli.Context) error {
|
||||
cfg, err := LoadConfig(a.flags.path)
|
||||
cfg, err := LoadConfig(curentDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load config: %w", err)
|
||||
}
|
||||
|
@ -71,7 +69,7 @@ func (a *action) RunInstall(c *cli.Context) error {
|
|||
}
|
||||
|
||||
func (a *action) RunUpdate(c *cli.Context) error {
|
||||
cfg, err := LoadConfig(a.flags.path)
|
||||
cfg, err := LoadConfig(curentDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load config: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue