blob: 10fd01470d6033cc9f1f3c6f8c25ae43be87d284 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package main
// TODO: print help when no arguments given
import (
"flag"
"fmt"
"os"
"git.server.ky/slackcoder/pkgtools-go"
"github.com/pborman/getopt/v2"
)
func usage() {
getopt.PrintUsage(os.Stdout)
}
func ParseFlags() *pkgtools.RemovePkgFlags {
flags := pkgtools.DefaultRemovePkgFlags
flags.SetEnvValues()
getopt.Parse()
return &flags
}
func main() {
getopt.SetParameters("packagename ...")
help := getopt.BoolLong("help", 0, "display help")
flags := ParseFlags()
if len(getopt.Args()) == 0 || *help {
usage()
return
}
err := pkgtools.RemovePkg(flags, flag.Args()...)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
}
|