2024-08-07 12:48:09 +00:00
|
|
|
package importer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.frostfs.info/TrueCloudLab/xk6-frostfs/internal/registry"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Cmd represents the import command.
|
|
|
|
var Cmd = &cobra.Command{
|
|
|
|
Use: "import",
|
|
|
|
Short: "Import objects into registry",
|
|
|
|
Long: "Import objects into registry from pregenerated files",
|
|
|
|
Example: `xk6-registry import registry.bolt preset.json
|
2024-10-08 17:12:39 +00:00
|
|
|
xk6-registry import registry.bolt preset.json another_preset.json`,
|
2024-08-07 12:48:09 +00:00
|
|
|
RunE: runCmd,
|
|
|
|
Args: cobra.MinimumNArgs(2),
|
|
|
|
}
|
|
|
|
|
|
|
|
func runCmd(cmd *cobra.Command, args []string) error {
|
|
|
|
objRegistry := registry.NewObjRegistry(cmd.Context(), args[0])
|
|
|
|
for i := 1; i < len(args); i++ {
|
|
|
|
if err := ImportJSONPreGen(objRegistry, args[i]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|