add missing link cleanup subcommand.

This commit is contained in:
sm
2016-07-09 21:40:14 -07:00
parent ceb4206787
commit 1abff34b3d
4 changed files with 118 additions and 2 deletions
+13 -1
View File
@@ -7,8 +7,9 @@ import (
"os"
)
const usage = "am <arr|help> [flags]"
const usage = "am <arr|clean|help> [flags]"
const arrUsage = "am arr [-h|-cores=N] <in> <out>"
const cleanUsage = "am clean [-h|-cores=N] <directory>"
type stats struct {
total int
@@ -41,6 +42,17 @@ func main() {
fmt.Fprintf(os.Stderr, "problem arranging media: %v\n", err)
os.Exit(1)
}
case "c", "cl", "clean":
args := flag.Args()
if len(args) != 1 {
fmt.Fprintf(os.Stderr, "%s\n", cleanUsage)
os.Exit(1)
}
dir := args[0]
if err := clean(dir); err != nil {
fmt.Fprintf(os.Stderr, "problem cleaning: %v\n", err)
os.Exit(1)
}
default:
fmt.Fprintf(os.Stderr, "%s\n", usage)
os.Exit(1)