mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-15 07:18:04 +00:00
i used this script, a little clunky but it got the job done
```bash
for file in `find . -type f -print | grep '\.go'`; do
sed '1,/^\/\/ limitations under the License.$/d' $file > $file.tmp;
result=`cat $file.tmp`
if [[ result != "" ]]; then
gofmt $file.tmp &> /dev/null;
if [[ $? == 0 ]]; then
mv $file.tmp $file && gofmt -w $file;
else
rm $file.tmp;
fi
else
rm $file.tmp;
fi
done
```
37 lines
1 KiB
Go
37 lines
1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/molecula/featurebase/v2/ctl"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newRestoreCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command {
|
|
cmd := ctl.NewRestoreCommand(stdin, stdout, stderr)
|
|
restoreCmd := &cobra.Command{
|
|
Use: "restore",
|
|
Short: "Restore from a backup",
|
|
Long: `
|
|
The Restore command will take a backup archive and restore it to a new, clean cluster.
|
|
`,
|
|
RunE: func(c *cobra.Command, args []string) error {
|
|
return cmd.Run(context.Background())
|
|
},
|
|
}
|
|
flags := restoreCmd.Flags()
|
|
flags.StringVarP(&cmd.Path, "source", "s", "", "backup file; specify '-' to restore from stdin tar stream")
|
|
flags.StringVar(&cmd.Host, "host", "localhost:10101", "host:port of FeatureBase.")
|
|
flags.IntVar(&cmd.Concurrency, "concurrency", 1, "number of concurrent uploads")
|
|
ctl.SetTLSConfig(
|
|
flags, "",
|
|
&cmd.TLS.CertificatePath,
|
|
&cmd.TLS.CertificateKeyPath,
|
|
&cmd.TLS.CACertPath,
|
|
&cmd.TLS.SkipVerify,
|
|
&cmd.TLS.EnableClientVerification,
|
|
)
|
|
|
|
return restoreCmd
|
|
}
|