Help us shape the future of Go! Take the 2026 Go Developer Survey

cmd

package
v2.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServeCmd = &cobra.Command{
	Use:   "serve",
	Short: "Wizard to be executed in source",
	Long: `The server part is run on the source / production system, where it automatically discovers used frameworks
and figures out what to extract. Depending on the framework, the system might NOT return the all dataset
- if you want to dump EVERYTHING, use the "--all" arg.`,
	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)
			}
		}

		pterm.PrintOnErrorf("Error initializing progress bar: %e", err)

		pterm.Debug.Printfln("Detecting Frameworks")

		for _, framework := range RegisteredFrameworks {
			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, all, keep, sigs)
				if err != nil {
					pterm.Fatal.Printfln("Error creating transfer session: %s", err)
				}

				framework.Serve(transferSession)

				if keep {

					pterm.Debug.Printfln("Running with --keep flag. No automatic cleanup.")
					os.Exit(0)
				} else {
					pterm.Debug.Printfln("Waiting for ctrl-c")

					<-done
					return
				}
			}
		}

		pterm.Error.Printfln("No frameworks could be detected. Aborting.")

		os.Exit(1)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL