From 72b5033710cede2d52c63afe3f6dec3d1e0f366b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 17 Oct 2025 16:29:56 -0500 Subject: renamed lib to argvpb --- argv.go | 52 ++++++++++------------------------------------------ 1 file changed, 10 insertions(+), 42 deletions(-) (limited to 'argv.go') diff --git a/argv.go b/argv.go index d73dbc0..9cfcd5d 100644 --- a/argv.go +++ b/argv.go @@ -6,14 +6,9 @@ package main */ import ( - "fmt" "os" - "strconv" - "strings" - "time" - "go.wit.com/lib/gui/prep" - "go.wit.com/lib/gui/shell" + "go.wit.com/lib/protobuf/argvpb" ) var argv args @@ -59,48 +54,21 @@ func (args) Buildtime() (string, string) { return BUILDTIME, VERSION } -func (args) Version() string { - parts := strings.Split(BUILDTIME, ".") - if len(parts) == 1 { - // The input epoch seconds - // epochSeconds := int64(1758646486) - num, err := strconv.Atoi(BUILDTIME) - epochSeconds := int64(num) - if err == nil { - - // 1. Convert the epoch seconds to a time.Time object. - // time.Unix() creates the time in the UTC timezone by default. - t := time.Unix(epochSeconds, 0) - - // 2. Convert the UTC time to the computer's local timezone. - localTime := t.Local() - - // 3. Print the result. The default format is clear and includes the timezone. - // fmt.Println("Default format:", localTime) - // For a more human-friendly format, use the Format() method. - // Go uses a special reference time for formatting: Mon Jan 2 15:04:05 2006 MST - // You lay out your desired format using these specific numbers. - // formattedString := localTime.Format("Monday, January 2, 2006 at 3:04:05 PM (MST)") - // fmt.Println(" Custom format:", formattedString) - - // now := time.Now() - // dur := time.Since(localTime) - BUILDTIME = fmt.Sprintf("%s age(%v)", localTime.String(), shell.FormatDuration(time.Since(localTime))) - } - } - - return ARGNAME + " " + VERSION + " Built on " + BUILDTIME -} - /* handles shell autocomplete */ -func (a args) DoAutoComplete(pb *prep.Auto) { +func (args) Version() string { + return argvpb.StandardVersion(ARGNAME, VERSION, BUILDTIME) +} + +// sends the strings to bash or zsh that will be your options +func (a args) SendCompletionStrings(pb *argvpb.Argv) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"--bash", "repos", "gui", "patches", "--daemon", "missing"}) + base := []string{"--bash", "repos", "gui", "patches", "--daemon", "missing"} + pb.SendStrings(base) } else { - pb.SubCommand(pb.Argv...) + pb.SubCommand(pb.Goargs...) } os.Exit(0) } -- cgit v1.2.3