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 [url] [password]`, Run: func(cmd *cobra.Command, args []string) { baseUrl := args[0] password := args[1] receiveSession, err := receive.NewSession(baseUrl, password) pterm.PrintOnErrorf("Error initializing receive session: %e", err) if err != nil { return } meta, err := receiveSession.FetchMeta() if err != nil { pterm.Fatal.Printfln("Metadata could not be fetched: %s", err) } 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, err = pterm.DefaultInteractiveMultiselect. WithDefaultText("Select data to download"). WithOptions(filesToDownload). WithDefaultOptions(filesToDownload). WithKeySelect(keys.Space). WithKeyConfirm(keys.Enter). WithFilter(false). Show() if err != nil { pterm.Fatal.Printfln("File Selector could not be shown: %s", err) } } 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.