Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InitCmd = &cobra.Command{ Use: "init", Short: "init setups package management for the project", Long: `init setups package management for the project. It setups Nix files based on the language detected. `, PreRun: func(cmd *cobra.Command, args []string) { precheck.AllPrechecks() }, Run: func(cmd *cobra.Command, args []string) { conf, err := configure.PreCheckConf() if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } isBaseImage, err := YesNoPrompt("Do you want to build a base image?") if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } var imageName string var pt langdetect.ProjectType var includeCommonDeps bool var commonDeps string if isBaseImage { imageName, err = IoPrompt("What should the image name be?") if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } includeCommonDeps, err = YesNoPrompt("Would you like to add common dependencies (compiler, linter, debugger, etc.)?") if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } if includeCommonDeps { commonDeps, err = IoPrompt("Which common deps would you like to add? (Go/Python/Rust/JsNpm)") if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } } } sc, err := search.NewClientWithAddr(conf.BuildSafeAPI, conf.BuildSafeAPITLS) if err != nil { fmt.Println(styles.ErrorStyle.Render("error:", err.Error())) os.Exit(1) } m := model{sc: sc, pt: pt, baseImgName: imageName, addCommonDeps: includeCommonDeps, commonDepsType: commonDeps} m.resetSpinner() if _, err := tea.NewProgram(m).Run(); err != nil { os.Exit(1) } }, }
InitCmd represents the init command
Functions ¶
func GetBSFInitializers ¶
func GetBSFInitializers() (bsfv1.SearchServiceClient, *hcl2nix.FileHandlers, error)
GetBSFInitializers generates the nix files
func YesNoPrompt ¶ added in v0.2.2
YesNoPrompt is used to promt a user for a bool based answer
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.