forked from TrueCloudLab/xk6-frostfs
Ekaterina Lebedeva
591f8af161
`status` flag is currently unsupported by `xk6-registry import`. Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
27 lines
731 B
Go
27 lines
731 B
Go
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
|
|
xk6-registry import registry.bolt preset.json another_preset.json`,
|
|
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
|
|
}
|