-
Notifications
You must be signed in to change notification settings - Fork 18
/
main.go
45 lines (38 loc) · 830 Bytes
/
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
// SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Open Component Model contributors.
//
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"os"
"strings"
)
// CFG is the path to the file containing the credentials
var CFG = "../examples/lib/cred.yaml"
var current_version string
func init() {
data, err := os.ReadFile("VERSION")
if err != nil {
panic("VERSION not found")
}
current_version = strings.TrimSpace(string(data))
}
func main() {
cmd := "basic"
if len(os.Args) > 1 {
cmd = os.Args[1]
}
var err error
switch cmd {
case "basic":
err = ComposingAComponentVersionA()
case "compose":
err = ComposingAComponentVersionB()
default:
err = fmt.Errorf("unknown example %q", cmd)
}
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
os.Exit(1)
}
}