From 8bd0da003e011f46bdd59549e35a3addda7efdf8 Mon Sep 17 00:00:00 2001 From: bth Date: Sat, 17 Jan 2026 20:06:55 -0800 Subject: [PATCH] dirs for each subcmd --- go.mod | 2 +- next/last.go | 14 ++++++++++++++ next/next.go | 8 ++++++++ sort/sort.go | 10 ++++++++++ tag/tag.go | 10 ++++++++++ um.go | 12 ++++++++++-- 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 next/last.go create mode 100644 next/next.go create mode 100644 sort/sort.go create mode 100644 tag/tag.go diff --git a/go.mod b/go.mod index 4b69b5d..aa7a135 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/brtholomy/um +module github.com/brtholomy/um/go go 1.25.4 diff --git a/next/last.go b/next/last.go new file mode 100644 index 0000000..70537dc --- /dev/null +++ b/next/last.go @@ -0,0 +1,14 @@ +package next + +import ( + "fmt" + "os/exec" +) + +func Last() { + ls, err := exec.Command("ls").Output() + if err != nil { + fmt.Print(err) + } + fmt.Printf("ls\n%s\n", string(ls)) +} diff --git a/next/next.go b/next/next.go new file mode 100644 index 0000000..ef9d2a1 --- /dev/null +++ b/next/next.go @@ -0,0 +1,8 @@ +package next + +import "fmt" + +func Next(args []string) { + fmt.Println("next") + fmt.Println(args) +} diff --git a/sort/sort.go b/sort/sort.go new file mode 100644 index 0000000..c6809af --- /dev/null +++ b/sort/sort.go @@ -0,0 +1,10 @@ +package sort + +import ( + "fmt" +) + +func Sort(args []string) { + fmt.Println("sort") + fmt.Println(args) +} diff --git a/tag/tag.go b/tag/tag.go new file mode 100644 index 0000000..8e9d857 --- /dev/null +++ b/tag/tag.go @@ -0,0 +1,10 @@ +package tag + +import ( + "fmt" +) + +func Tag(args []string) { + fmt.Println("tag") + fmt.Println(args) +} diff --git a/um.go b/um.go index 99824d8..8697154 100644 --- a/um.go +++ b/um.go @@ -5,6 +5,10 @@ import ( "fmt" "os" "strings" + + nextpkg "github.com/brtholomy/um/go/next" + sortpkg "github.com/brtholomy/um/go/sort" + tagpkg "github.com/brtholomy/um/go/tag" ) type Subcommand string @@ -62,16 +66,20 @@ func main() { switch cmd { case next: - fmt.Printf("args: %#v\n", args) + nextpkg.Next(args) + case last: + nextpkg.Last() case tag: + // TODO: move flag defs to the package? tagFlags.Parse(prependFlagToArgs(args, query)) - fmt.Println(tag) + tagpkg.Tag(args) fmt.Printf("query: %#v\n", *tagQuery) fmt.Printf("invert: %#v\n", *tagInvert) fmt.Printf("args: %#v\n", tagFlags.Args()) tagFlags.Usage() case sort: sortFlags.Parse(args) + sortpkg.Sort(args) fmt.Println("subcmd sort") fmt.Printf("key: %#v\n", *sortKey) fmt.Printf("args: %#v\n", sortFlags.Args())