Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReceiveCmd = &cobra.Command{ Use: "receive", Short: "Wizard to be executed in target", Long: `...`, Args: cobra.ExactArgs(2), Example: `synco receive [identifier] [password]`, Run: func(cmd *cobra.Command, args []string) { identifier := args[0] password := args[1] receiveSession, err := receive.NewSession(identifier, password) pterm.PrintOnErrorf("Error initializing receive session: %s", err) if err != nil { return } err = detectBaseUrlAndUpdateReceiveSession(receiveSession) if err != nil { pterm.Error.Printfln("Error detecting base URL: %s", err) return } meta, err := receiveSession.FetchMeta() if err != nil { pterm.Error.Printfln("Metadata could not be fetched: %s", err) return } pterm.Success.Printfln("Valid Decryption Key") pterm.Info.Printfln("Framework on server: %s", meta.FrameworkName) if meta.State != dto.STATE_READY { pterm.Error.Printfln("Received state '%s', but you need to run the tool once Ready state exists. Please re-run!", meta.State) os.Exit(1) } filesToDownload := fp.Map(func(fileSet *dto.FileSet) string { return fileSet.Label() })(meta.FileSets) if interactive { filesToDownload = multiselect.Exec("Select data to download", filesToDownload, filesToDownload) } for _, fileToDownload := range filesToDownload { fileSet := meta.FileSetByLabel(fileToDownload) pterm.Info.Printfln("Downloading: %s (%s)", fileToDownload, fileSet.Type) switch fileSet.Type { case dto.TYPE_MYSQLDUMP: err = downloadMysqldump(receiveSession, fileSet) case dto.TYPE_PUBLICFILES: err = downloadPublicFiles(receiveSession, fileSet) default: pterm.Fatal.Printfln("File Set type %s was unimplemented.", fileSet.Type) } if err != nil { pterm.Fatal.Printfln("Error with file type %s: %s", fileSet.Type, err) } } pterm.Success.Printfln("All downloaded to dump/") pterm.Success.Printfln("FINISHED :) Now, terminate %s on the server side by pressing %s.", pterm.ThemeDefault.PrimaryStyle.Sprint("synco serve"), pterm.ThemeDefault.PrimaryStyle.Sprint("Ctrl-C")) os.Exit(0) }, }
View Source
var RegisteredFrameworks = [...]common.ReceiveFramework{ flowReceive.NewFlowFramework(), }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.