diff options
| author | Jeff Carr <[email protected]> | 2025-10-27 10:44:52 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-27 10:44:52 -0500 |
| commit | ac81e470cfecaf8387ff621bd36ced28e56ee3fc (patch) | |
| tree | 743bd7a06c76f63f2cdee644b5dbeb54b739c12f /complete.go | |
| parent | a0dae603e2de74f0184991dff2bddf14d27a65ed (diff) | |
some working on seperate cache / mode settings
Diffstat (limited to 'complete.go')
| -rw-r--r-- | complete.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/complete.go b/complete.go index 191cf90..83c00de 100644 --- a/complete.go +++ b/complete.go @@ -103,6 +103,11 @@ func (a args) DoAutoComplete() error { fmt.Fprintf(argvpb.Stderr, "returned from parseFlagsArgv(%v)\n", err) } } + if argvpb.PB.IsMatch("cache") { + matches, _ := matchCacheFiles() + fmt.Fprintf(argvpb.Stdout, matches) + return nil + } if argvpb.PB.IsMatch("mode.--config") { matches, _ := matchModeDirs() fmt.Fprintf(argvpb.Stdout, matches) @@ -116,7 +121,7 @@ func (a args) DoAutoComplete() error { } if argvpb.PB.GetCmd() == "" { // these are base autocomplete strings - matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config"} + matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config", "cache"} matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged") matches = append(matches, "--version", "--force", "--all", "--verbose") fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " ")) @@ -144,3 +149,18 @@ func matchModeDirs() (string, error) { // log.Info("glob:", globPattern, "matchdirs:", match) return match, err } + +func matchCacheFiles() (string, error) { + configDir, _ := os.UserCacheDir() + globPattern := filepath.Join(configDir, "forge", "repos*.pb") + files, err := filepath.Glob(globPattern) + match := "all golang homedir" + for _, file := range files { + if config.IsDir(file) { + _, base := filepath.Split(file) + match += base + " " + } + } + // log.Info("glob:", globPattern, "matchdirs:", match) + return match, err +} |
