dae/cmd/cmd.go

48 lines
1.0 KiB
Go
Raw Normal View History

/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
*/
2023-01-27 01:10:27 +07:00
package cmd
import (
"fmt"
"runtime"
"strings"
"github.com/daeuniverse/dae/config"
2023-01-27 01:10:27 +07:00
"github.com/spf13/cobra"
)
const (
AbortFile = "/var/run/dae.abort"
)
2023-01-27 01:10:27 +07:00
var (
Version = "unknown"
rootCmd = &cobra.Command{
Use: "dae [flags] [command [argument ...]]",
2023-03-03 15:36:22 +07:00
Short: "dae is a high-performance transparent proxy solution.",
Long: `dae is a high-performance transparent proxy solution.`,
2023-01-27 01:10:27 +07:00
Version: Version,
2023-01-28 01:01:33 +07:00
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
2023-01-27 01:10:27 +07:00
}
)
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")
}
2023-01-27 01:10:27 +07:00
// Execute executes the root command.
func Execute() error {
return rootCmd.Execute()
}