flags pkg : but im not convinced this is right

This commit is contained in:
bth 2026-01-17 20:21:37 -08:00
commit f483e08105
4 changed files with 57 additions and 48 deletions

View file

@ -1,10 +1,23 @@
package sort
import (
"flag"
"fmt"
"github.com/brtholomy/um/go/flags"
)
const (
key flags.Flag = "key"
)
func Sort(args []string) {
fmt.Println("sort")
fmt.Println(args)
sortFlags := flag.NewFlagSet("sort", flag.ExitOnError)
sortKey := sortFlags.String(string(key), "", "filename of ordered list to use as key")
sortFlags.Parse(args)
fmt.Println("subcmd sort")
fmt.Printf("key: %#v\n", *sortKey)
fmt.Printf("args: %#v\n", sortFlags.Args())
sortFlags.Usage()
}