Skip to content

Commit

Permalink
refactor clean
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmonsays committed Dec 3, 2022
1 parent b727756 commit 6f2a241
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
21 changes: 8 additions & 13 deletions clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func (me *Clean) RunFile(path string) error {

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

err := me.CleanUnreferenced(cfg)
if err != nil {
log.Warnf("Clean unreferenced %s", err)
}

return nil
}
func (me *Clean) CleanUnreferenced(cfg *AppConfig) error {
run, err := CompileRun(cfg.Symlinks, cfg.Script)
if err != nil {
return err
Expand Down Expand Up @@ -70,16 +78,3 @@ func (me *Clean) RunConfig(cfg *AppConfig) error {
return nil

}

func ListDir(path string) ([]string, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
names, err := f.Readdirnames(1000)
if err != nil {
return nil, err
}
return names, nil
}
13 changes: 13 additions & 0 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ func (me *Context) getConfigFiles(c *cli.Context) []string {
}
return ret
}

func ListDir(path string) ([]string, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
names, err := f.Readdirnames(1000)
if err != nil {
return nil, err
}
return names, nil
}

0 comments on commit 6f2a241

Please sign in to comment.