-
Notifications
You must be signed in to change notification settings - Fork 63
/
init.go
70 lines (62 loc) · 1.43 KB
/
init.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
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.
// Licensed under the BSD-3-Clause License (the "License").
// You may not use this file except in compliance with the License.
package manifest
import (
"kraftkit.sh/cmdfactory"
"kraftkit.sh/packmanager"
// "kraftkit.sh/packmanager"
)
var (
// useGit is a local variable used within the context of the manifest package
// and is dynamically injected as a CLI option.
useGit = false
// gitCloneDepth is used during the cloning process to indicate the clone
// depth.
gitCloneDepth = -1
)
func RegisterPackageManager() func(u *packmanager.UmbrellaManager) error {
return func(u *packmanager.UmbrellaManager) error {
return u.RegisterPackageManager(ManifestFormat, NewManifestManager)
}
}
func RegisterFlags() {
// Register additional command-line flags
cmdfactory.RegisterFlag(
"kraft pkg pull",
cmdfactory.BoolVarP(
&useGit,
"git", "g",
false,
"Use Git when pulling sources",
),
)
cmdfactory.RegisterFlag(
"kraft pkg pull",
cmdfactory.IntVar(
&gitCloneDepth,
"git-depth",
-1,
"Set the Git clone depth",
),
)
cmdfactory.RegisterFlag(
"kraft build",
cmdfactory.BoolVarP(
&useGit,
"git", "g",
false,
"Use Git when pulling sources",
),
)
cmdfactory.RegisterFlag(
"kraft build",
cmdfactory.IntVar(
&gitCloneDepth,
"git-depth",
-1,
"Set the Git clone depth",
),
)
}