You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
421 B
Go
25 lines
421 B
Go
2 years ago
|
package cli
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
|
||
|
"github.com/urfave/cli/v2"
|
||
|
)
|
||
|
|
||
|
func clean(ctx *cli.Context) (err error) {
|
||
|
entries, err := ioutil.ReadDir(downloadsDir)
|
||
|
if err != nil {
|
||
|
return cli.Exit(errstring(err), 1)
|
||
|
}
|
||
|
|
||
|
for i := range entries {
|
||
|
if err = os.RemoveAll(filepath.Join(downloadsDir, entries[i].Name())); err == nil {
|
||
|
fmt.Println("Remove", entries[i].Name())
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|