feat: migrate to use cobra as cli dep

This commit is contained in:
2026-03-16 23:36:01 +00:00
parent f37548b56b
commit 9cf3ed6a5c
6 changed files with 262 additions and 40 deletions
+15 -13
View File
@@ -5,21 +5,23 @@ import (
"miro/internal/miro"
"miro/internal/output"
"github.com/spf13/cobra"
)
func runRecord(args []string) int {
if len(args) != 1 {
output.Println("record requires exactly one path")
return 1
}
func newRecordCommand() *cobra.Command {
return &cobra.Command{
Use: "record <path>",
Args: cobra.ExactArgs(1),
RunE: func(_ *cobra.Command, args []string) error {
path := filepath.Clean(args[0])
createdPath, err := miro.Record(path)
if err != nil {
return err
}
path := filepath.Clean(args[0])
createdPath, err := miro.Record(path)
if err != nil {
output.Printf("%v\n", err)
return 1
output.Println(createdPath)
return nil
},
}
output.Println(createdPath)
return 0
}