flags rewrite : just well defined structs and a clear switch block

This commit is contained in:
bth 2026-01-18 09:03:27 -08:00
commit f23a98fb5d
3 changed files with 63 additions and 76 deletions

View file

@ -1,23 +1,9 @@
package sort
import (
"flag"
"fmt"
"github.com/brtholomy/um/go/flags"
)
const (
key flags.Flag = "key"
)
func Sort(args []string) {
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()
fmt.Printf("args: %#v\n", args)
}