-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (36 loc) · 1.28 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
package main
import (
"github.com/rohitramu/kpm/src/cli"
"github.com/rohitramu/kpm/src/cli/model/utils/constants"
"github.com/rohitramu/kpm/src/pkg/utils/log"
"runtime/debug"
"strconv"
)
// TODO: Make it possible to provide just the package name as an argument without the username prefix (unless it's ambiguous).
// TODO: Introduce the concept of "repositories". The one with the highest priority will be the local repository.
// Repositories can be added and removed by users. Need to define different repository types (e.g. local filesystem, Docker, GitHub, etc.)
// Need to handle authentication for private remote repositories (i.e. Docker, GitHub, etc.)
func main() {
var err error
info, ok := debug.ReadBuildInfo()
if !ok {
panic("Failed to get build info")
}
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
constants.GitCommitHash = setting.Value
case "vcs.time":
constants.BuildTimestampUTC = setting.Value
case "vcs.modified":
constants.IsSourceModified, _ = strconv.ParseBool(setting.Value)
}
}
if constants.IsSourceModified {
constants.VersionString += "-dirty"
constants.GitCommitHash += " (modified)"
}
if err = cli.Execute(); err != nil {
log.Errorf("Failed to execute command: %s", err.Error())
}
}