This repository has been archived by the owner on Jan 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
81 lines (76 loc) · 2.38 KB
/
main.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) == 1 {
fmt.Fprintln(os.Stderr,
"Missing command, use help for a list of commands!")
os.Exit(1)
}
if err := parseConfig(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
var err error
switch os.Args[1] {
case "help":
fmt.Println("Usage: prt command [arguments]")
fmt.Println("")
fmt.Println("commands:")
fmt.Println(" depends list dependencies recursively")
fmt.Println(" download download port sources")
fmt.Println(" chart generate dependency chart")
fmt.Println(" diff list outdated packages")
fmt.Println(" info print port information")
//fmt.Println(" install build and install ports and their dependencies")
fmt.Println(" list list ports and packages")
fmt.Println(" loc print port locations")
//fmt.Println(" make make package from port")
//fmt.Println(" patch patch ports")
fmt.Println(" prov search ports for files")
fmt.Println(" pull pull in ports")
//fmt.Println(" sysup update outdated packages")
//fmt.Println(" uninstall uninstall packages")
fmt.Println(" unpack unpack port sources")
fmt.Println(" help print help and exit")
case "depends":
err = dependsCommand(os.Args[2:])
case "download":
err = downloadCommand(os.Args[2:])
case "diff":
err = diffCommand(os.Args[2:])
case "chart":
err = chartCommand(os.Args[2:])
case "info":
err = infoCommand(os.Args[2:])
//case "install":
// err = installCommand(os.Args[2:])
case "list":
err = listCommand(os.Args[2:])
case "loc":
err = locCommand(os.Args[2:])
//case "make":
// err = makeCommand(os.Args[2:])
//case "patch":
// err = patchCommand(os.Args[2:])
case "prov":
err = provCommand(os.Args[2:])
case "pull":
err = pullCommand(os.Args[2:])
//case "sysup":
// err = sysupCommand(os.Args[2:])
//case "uninstall":
// err = uninstallCommand(os.Args[2:])
case "unpack":
err = unpackCommand(os.Args[2:])
default:
err = fmt.Errorf("invalid command, use `help` for a list of commands")
}
if err != nil {
fmt.Fprintf(os.Stderr, "%s!\n", capitalize(err.Error()))
os.Exit(1)
}
os.Exit(0)
}