diff options
| author | Jeff Carr <[email protected]> | 2025-10-17 16:29:56 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-17 16:29:56 -0500 | 
| commit | 72b5033710cede2d52c63afe3f6dec3d1e0f366b (patch) | |
| tree | c59a2b090314120968a14585b6728b2b6d24601e | |
| parent | 44b8f48a273a0d6f9e27e91fb368c1972744d2c9 (diff) | |
renamed lib to argvpb
| -rw-r--r-- | argv.go | 52 | ||||
| -rw-r--r-- | doRepos.go | 9 | ||||
| -rw-r--r-- | main.go | 6 | ||||
| -rw-r--r-- | structs.go | 6 | 
4 files changed, 22 insertions, 51 deletions
@@ -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)  } @@ -14,7 +14,8 @@ import (  func doRepos() error {  	if argv.Repos.List != nil { -		me.forge.PrintForgedTable(me.forge.Repos) +		footer := me.forge.Repos.PrintForgedTable() +		log.Info("footer:", footer)  		// me.forge.PrintPullTable(me.forge.Repos)  		// return doReposList()  		return nil @@ -28,7 +29,8 @@ func doRepos() error {  			}  			found.Append(repo)  		} -		me.forge.PrintForgedTable(found) +		footer := found.PrintForgedTable() +		log.Info("footer:", footer)  		return nil  	} @@ -135,7 +137,8 @@ func doRepos() error {  	found := gitpb.NewRepos()  	found.Append(me.forge.Repos.Repos[0])  	found.Append(me.forge.Repos.Repos[1]) -	me.forge.PrintForgedTable(found) +	footer := found.PrintForgedTable() +	log.Info(footer)  	return nil  } @@ -9,7 +9,7 @@ import (  	"path/filepath"  	"time" -	"go.wit.com/lib/gui/prep" +	"go.wit.com/lib/protobuf/argvpb"  	"go.wit.com/lib/protobuf/forgepb"  	"go.wit.com/lib/protobuf/gitpb"  	"go.wit.com/log" @@ -35,8 +35,8 @@ func saveMissing() error {  func main() {  	me = new(mainType) -	me.myGui = prep.Gui()      // prepares the GUI package for go-args -	me.auto = prep.Bash(&argv) // this line should be:  prep.Bash(&argv) +	me.myGui = argvpb.Gui()              // prepares the GUI package for go-args +	me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args  	me.forge = forgepb.InitByFullpath("/etc/forged/forge.text")  	me.forge.Config.DumpENV() @@ -5,7 +5,7 @@ package main  import (  	"go.wit.com/dev/alexflint/arg" -	"go.wit.com/lib/gui/prep" +	"go.wit.com/lib/protobuf/argvpb"  	"go.wit.com/lib/protobuf/forgepb"  	"go.wit.com/lib/protobuf/gitpb"  ) @@ -16,8 +16,8 @@ var me *mainType  type mainType struct {  	pp      *arg.Parser           // for parsing the command line args.  Yay to alexf lint!  	forge   *forgepb.Forge        // for holding the forge protobuf files -	myGui   *prep.GuiPrep         // the gui toolkit handle -	auto    *prep.Auto            // more experiments for bash handling +	myGui   *argvpb.GuiPrep       // the gui toolkit handle +	argv    *argvpb.Argv          // shell autocomplete  	configs *forgepb.ForgeConfigs // for holding the forge protobuf files  	missing *gitpb.Repos          // repos we are missing  }  | 
