Skip to content

Commit

Permalink
rename to clean
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmonsays committed Dec 3, 2022
1 parent ff5a968 commit b727756
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
10 changes: 5 additions & 5 deletions cleanup.go → clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/urfave/cli/v2"
)

type Cleanup struct {
type Clean struct {
ctx *Context
}

func (me *Cleanup) Flags() []cli.Flag {
func (me *Clean) Flags() []cli.Flag {
return []cli.Flag{}
}

func (me *Cleanup) Run(c *cli.Context) error {
func (me *Clean) Run(c *cli.Context) error {
configfiles := me.ctx.getConfigFiles(c)

for _, filename := range configfiles {
Expand All @@ -27,7 +27,7 @@ func (me *Cleanup) Run(c *cli.Context) error {
return nil
}

func (me *Cleanup) RunFile(path string) error {
func (me *Clean) RunFile(path string) error {
log.Tracef("runfile %s", path)
cfg := GetDefaultConfig()
err := cfg.LoadYaml(path)
Expand All @@ -40,7 +40,7 @@ func (me *Cleanup) RunFile(path string) error {
return me.RunConfig(cfg)
}

func (me *Cleanup) RunConfig(cfg *AppConfig) error {
func (me *Clean) RunConfig(cfg *AppConfig) error {

run, err := CompileRun(cfg.Symlinks, cfg.Script)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// main configuration structure
type AppConfig struct {
Clean []string `yaml:"clean"`
Mkdirs []string `yaml:"mkdirs"`
Symlinks map[string]string `yaml:"symlinks"`
Script []*Script `yaml:"script"`
Expand Down
8 changes: 8 additions & 0 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func (me *Link) RunConfig(opts *LinkOptions, cfg *AppConfig) error {
if err != nil {
return err
}
err = CleanLinks(opts, run)
if err != nil {
return err
}

return nil
}
Expand Down Expand Up @@ -236,3 +240,7 @@ func RunScripts(opts *LinkOptions, run *Run, stype string) error {

return nil
}

func CleanLinks(opts *LinkOptions, run *Run) error {
return nil
}
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {
link := &Link{ctx}
unlink := &Unlink{ctx}
status := &Status{ctx}
cleanup := &Cleanup{ctx}
clean := &Clean{ctx}

app := &cli.App{
Name: "dotbot",
Expand Down Expand Up @@ -66,10 +66,10 @@ func main() {
Flags: status.Flags(),
})
ctx.addCommand(&cli.Command{
Name: "cleanup",
Name: "clean",
Usage: "show unreferenced files",
Action: cleanup.Run,
Flags: cleanup.Flags(),
Action: clean.Run,
Flags: clean.Flags(),
})
app.Run(os.Args)
}

0 comments on commit b727756

Please sign in to comment.