dotfiles/internal/config/config_demo.go

73 lines
1.1 KiB
Go
Raw Normal View History

package config
import "fmt"
2023-02-25 15:44:26 +00:00
type ConfigDemo struct {
2023-02-25 15:07:37 +00:00
ConfigApps
}
2023-02-25 15:44:26 +00:00
var _ Config = (*ConfigDemo)(nil)
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Install() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
2022-10-24 14:57:44 +00:00
if p.External == "" {
continue
}
2023-02-25 15:36:50 +00:00
fmt.Printf("Replace [%s] -> [%s]\n", p.Internal, p.External)
}
}
return nil
}
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Update() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
2022-10-24 14:57:44 +00:00
if p.External == "" {
continue
}
2023-02-25 15:36:50 +00:00
fmt.Printf("Replace [%s] -> [%s]\n", p.External, p.Internal)
}
}
return nil
}
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Download() error {
2022-10-24 14:57:44 +00:00
for _, app := range c.Apps {
for _, p := range app.Paths {
if p.URL == "" {
continue
}
2023-02-25 15:36:50 +00:00
fmt.Printf("Download [%s] -> [%s]\n", p.URL, p.Internal)
2022-10-24 14:57:44 +00:00
}
}
return nil
}
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Clean() error {
unusedDirs, err := getUnusedDirs(c.Apps)
if err != nil {
return err
}
for dir := range unusedDirs {
2023-02-25 15:36:50 +00:00
fmt.Printf("Remove [%s]\n", dir)
}
return nil
}
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Diff() error {
return nil
}
2023-02-25 15:30:20 +00:00
2023-02-25 15:44:26 +00:00
func (c *ConfigDemo) Validate() error {
2023-02-25 15:30:20 +00:00
return nil
}