Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RegisteredFrameworks = [...]common.ServeFramework{ flowServe.NewFlowFramework(), }
View Source
var ServeCmd = &cobra.Command{ Use: "serve", Short: "Wizard to be executed in source", Long: `...`, Example: `synco serve `, Run: func(cmd *cobra.Command, args []string) { sigs := make(chan os.Signal, 1) done := make(chan bool, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) var err error if len(password) == 0 { password, err = util.GenerateRandomString(30) if err != nil { pterm.Fatal.Printfln("Error generating random password: %s", err) } } if len(identifier) == 0 { identifier, err = util.GenerateRandomString(7) if err != nil { pterm.Fatal.Printfln("Error generating identifier password: %s", err) } } progressbar, err := pterm.DefaultProgressbar.WithTotal(3).Start() pterm.PrintOnErrorf("Error initializing progress bar: %e", err) pterm.Debug.Printfln("Detecting Frameworks") for _, framework := range RegisteredFrameworks { progressbar.Add(1) pterm.Debug.Printfln("Checking for %s framework", framework.Name()) if framework.Detect() { pterm.Info.Printfln("Found %s framework.", framework.Name()) transferSession, err := serve.NewSession(identifier, password, listen, sigs, done) if err != nil { pterm.Fatal.Printfln("Error creating transfer session: %s", err) } framework.Serve(transferSession) pterm.Debug.Printfln("Waiting for ctrl-c") <-done pterm.Debug.Printfln("Exiting") os.Exit(0) return } } pterm.Error.Printfln("No frameworks could be detected. Aborting.") os.Exit(1) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.