/
version.go
51 lines (40 loc) · 1.18 KB
/
version.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
// Copyright (c) arkade author(s) 2022. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package cmd
import (
"fmt"
"github.com/alexellis/arkade/pkg"
"github.com/morikuni/aec"
"github.com/spf13/cobra"
)
func PrintArkadeASCIIArt() {
arkadeLogo := aec.BlueF.Apply(arkadeFigletStr)
fmt.Print(arkadeLogo)
}
func MakeVersion() *cobra.Command {
var command = &cobra.Command{
Use: "version",
Short: "Print the version",
Example: ` arkade version`,
Aliases: []string{"v"},
SilenceUsage: false,
}
command.Run = func(cmd *cobra.Command, args []string) {
PrintArkadeASCIIArt()
if len(pkg.Version) == 0 {
fmt.Println("Version: dev")
} else {
fmt.Println("Version:", pkg.Version)
}
fmt.Println("Git Commit:", pkg.GitCommit)
fmt.Println("\n", aec.Bold.Apply(pkg.SupportMessageShort))
}
return command
}
const arkadeFigletStr = ` _ _
__ _ _ __| | ____ _ __| | ___
/ _` + "`" + ` | '__| |/ / _` + "`" + ` |/ _` + "`" + ` |/ _ \
| (_| | | | < (_| | (_| | __/
\__,_|_| |_|\_\__,_|\__,_|\___|
Open Source Marketplace For Developer Tools
`