Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EditCmd = &cobra.Command{ Use: "edit", Short: "Edit .env file using built-in editor", RunE: func(cmd *cobra.Command, _ []string) error { if viper.GetBool("debug") { f, err := tea.LogToFile("tea-debug.log", "debug") if err != nil { fmt.Println("fatal:", err) os.Exit(1) } defer f.Close() } cwd, err := os.Getwd() if err != nil { return err } dotenvFile := filepath.Join(cwd, ".env") templateLines, templateFileUsed := readTemplate(dotenvFile) variables := parseVariablesOnly(templateLines) contents := strings.Join(templateLines, "") screen := editorScreen if repo.IsInRepo() { if handleExtraEnvVars(variables) { screen = wizardScreen } } m := Model{ initialScreen: screen, DotenvFile: dotenvFile, DotenvTemplate: templateFileUsed, variables: variables, contents: contents, SuccessCmd: tea.Quit, } p := tea.NewProgram( tui.NewInterruptibleModel(m), tea.WithAltScreen(), tea.WithContext(cmd.Context()), ) _, err = p.Run() return err }, }
View Source
var SetupCmd = &cobra.Command{ Use: "setup", Short: "Edit .env file using setup wizard", RunE: func(cmd *cobra.Command, _ []string) error { if viper.GetBool("debug") { f, err := tea.LogToFile("tea-debug.log", "debug") if err != nil { fmt.Println("fatal:", err) os.Exit(1) } defer f.Close() } cwd, err := os.Getwd() if err != nil { return err } dotenvFile := filepath.Join(cwd, ".env") templateLines, templateFileUsed := readTemplate(dotenvFile) variables, contents, _ := variablesFromTemplate(templateLines) m := Model{ initialScreen: wizardScreen, DotenvFile: dotenvFile, DotenvTemplate: templateFileUsed, variables: variables, contents: contents, SuccessCmd: tea.Quit, } p := tea.NewProgram( tui.NewInterruptibleModel(m), tea.WithAltScreen(), tea.WithContext(cmd.Context()), ) _, err = p.Run() return err }, }
View Source
var UpdateCmd = &cobra.Command{ Use: "update", Short: "Automatically update Datarobot credentials in .env file", Long: "Automatically populate .env file with fresh Datarobot credentials", PreRunE: func(cmd *cobra.Command, _ []string) error { return auth.EnsureAuthenticatedE(cmd.Context()) }, Run: func(_ *cobra.Command, _ []string) { dotenvFile := ".env" _, _, _, err := writeUsingTemplateFile(dotenvFile) if err != nil { log.Error(err) } }, }
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.