2021-06-08 20:43:39 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var renameSimCommand = &cli.Command{
|
|
|
|
Name: "rename",
|
|
|
|
ArgsUsage: "<new-name>",
|
2021-06-18 18:17:35 +00:00
|
|
|
Action: func(cctx *cli.Context) (err error) {
|
2021-06-08 20:43:39 +00:00
|
|
|
node, err := open(cctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-18 18:17:35 +00:00
|
|
|
defer func() {
|
|
|
|
if cerr := node.Close(); err == nil {
|
|
|
|
err = cerr
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2021-06-08 20:43:39 +00:00
|
|
|
if cctx.NArg() != 1 {
|
|
|
|
return fmt.Errorf("expected 1 argument")
|
|
|
|
}
|
|
|
|
name := cctx.Args().First()
|
|
|
|
return node.RenameSim(cctx.Context, cctx.String("simulation"), name)
|
|
|
|
},
|
|
|
|
}
|