mirror of
https://gitlab.durp.info/durfy/apps/durpcli.git
synced 2026-05-07 07:50:35 -05:00
update
This commit is contained in:
parent
716b7424c4
commit
d96fae1276
13 changed files with 810 additions and 568 deletions
18
cmd/root.go
18
cmd/root.go
|
|
@ -21,11 +21,12 @@ var rootCmd = &cobra.Command{
|
|||
Long: ``,
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
func Execute() error {
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setDefaults() {
|
||||
|
|
@ -46,9 +47,21 @@ func init() {
|
|||
initConfig()
|
||||
loadConfig()
|
||||
|
||||
// styles := tui.DefaultStyles()
|
||||
// styles.Title.BorderForeground(lipgloss.AdaptiveColor{Light: `#E3BD2D`, Dark: `#E3BD2D`})
|
||||
// styles.Border.BorderForeground(lipgloss.AdaptiveColor{Light: `#E3BD2D`, Dark: `#E3BD2D`})
|
||||
// styles.SelectedItem.Foreground(lipgloss.AdaptiveColor{Light: `#353C3B`, Dark: `#353C3B`}).
|
||||
// Background(lipgloss.AdaptiveColor{Light: `#E3BD2D`, Dark: `#E3BD2D`})
|
||||
//
|
||||
// b := tui.New(tui.WithStyles(styles))
|
||||
|
||||
// rootCmd.SetUsageFunc(b.UsageFunc)
|
||||
// rootCmd.SetHelpFunc(b.HelpFunc)
|
||||
|
||||
rootCmd.AddCommand(net.NetCmd)
|
||||
rootCmd.AddCommand(auth.AuthCmd)
|
||||
rootCmd.AddCommand(cfg.Cfgcmd)
|
||||
rootCmd.AddCommand(initialize())
|
||||
rootCmd.PersistentFlags().
|
||||
StringVar(&cfgFile, "config", "", "config file (default is $HOME/.DurpCLI.yaml)")
|
||||
|
||||
|
|
@ -67,6 +80,7 @@ func initConfig() {
|
|||
|
||||
func loadConfig() {
|
||||
viper.AutomaticEnv()
|
||||
viper.AddConfigPath("~/.durpcli.yaml")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
fmt.Println("Config file not found. Creating a new one with defaults...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue