feat: add a --save option to avoid the interactive prompt on mire record for save
This commit is contained in:
+8
-2
@@ -11,13 +11,15 @@ import (
|
||||
)
|
||||
|
||||
func newRecordCommand() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
var save bool
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "record <path>",
|
||||
Short: "Record a new CLI scenario",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
path := filepath.Clean(args[0])
|
||||
createdPath, err := mire.Record(path)
|
||||
createdPath, err := mire.Record(path, mire.RecordOptions{Save: save})
|
||||
if err != nil {
|
||||
if errors.Is(err, mire.ErrRecordingDiscarded) {
|
||||
return nil
|
||||
@@ -30,4 +32,8 @@ func newRecordCommand() *cobra.Command {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().BoolVar(&save, "save", false, "Save the recording without prompting")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user