-
Notifications
You must be signed in to change notification settings - Fork 165
/
cmd.go
47 lines (40 loc) · 1.01 KB
/
cmd.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
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
*/
package cmd
import (
"fmt"
"runtime"
"strings"
"github.com/daeuniverse/dae/config"
"github.com/spf13/cobra"
)
const (
AbortFile = "/var/run/dae.abort"
)
var (
Version = "unknown"
rootCmd = &cobra.Command{
Use: "dae [flags] [command [argument ...]]",
Short: "dae is a high-performance transparent proxy solution.",
Long: `dae is a high-performance transparent proxy solution.`,
Version: Version,
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
}
)
func init() {
config.Version = Version
rootCmd.Version = strings.Join([]string{
Version,
fmt.Sprintf("go runtime %v %v/%v", runtime.Version(), runtime.GOOS, runtime.GOARCH),
"Copyright (c) 2022-2024 @daeuniverse",
"License GNU AGPLv3 <https://github.com/daeuniverse/dae/blob/main/LICENSE>",
}, "\n")
}
// Execute executes the root command.
func Execute() error {
return rootCmd.Execute()
}