Repository: rsteube/carapace
Pull request #488 (2022-04-09 19:18:59)

doc: update cachedir


Patch:
diff --git a/docs/src/carapace/cache.md b/docs/src/carapace/cache.md
index aad1bf9..4c128d9 100644
--- a/docs/src/carapace/cache.md
+++ b/docs/src/carapace/cache.md
@@ -1,19 +1,19 @@
 # Cache
 
-> Cache is still _experimental_ and will undergo some changes
-
 [`Cache`](https://pkg.go.dev/github.com/rsteube/carapace#Action.Cache) provides a simple way to cache [callback actions](./action/actionCallback.md).
-For this the values of an [InvokedAction](./invokedAction.md) are persisted as `json` to [`os.TempDir`](https://pkg.go.dev/os#TempDir):
+For this the values of an [InvokedAction](./invokedAction.md) are persisted as `json` to [`os.UserCacheDir`](https://pkg.go.dev/os#UserCacheDir):
 
 ```handlebars
-{{TempDir}}/carapace/{{username}}/{{binary}}/{{callerChecksum}}/{{cacheChecksum}}
+{{cacheDir}}/carapace/{{username}}/{{binary}}/{{callerChecksum}}/{{cacheChecksum}}
 ```
 
-| ID | x | example |
-|----|---|---|
-| TempDir | os.TempDir | `/tmp` |
-| username | current user | `root` |
-| binary | binary name | `carapace` |
-| callerChecksum | sha1sum using [`runtime.Caller`](https://pkg.go.dev/runtime#Caller) | `89be88b670885d3d7855c7169ad7cfd2816a6c37` |
-| cacheChecksum | sh1sum of given [`CacheKeys`](https://pkg.go.dev/github.com/rsteube/carapace/pkg/cache#CacheKey) | `041858daaaa8b084122d4604a3223315c39edc3e` |
+| ID             | x                                | example                                    |
+| ----           | ---                              | ---                                        |
+| cacheDir       | os.UserCacheDir                  | `~/.cache/`                                |
+| username       | current user                     | `root`                                     |
+| binary         | binary name                      | `carapace`                                 |
+| callerChecksum | sha1sum using [`runtime.Caller`] | `89be88b670885d3d7855c7169ad7cfd2816a6c37` |
+| cacheChecksum  | sh1sum of given [`CacheKeys`]    | `041858daaaa8b084122d4604a3223315c39edc3e` |
 
+[`runtime.Caller`]:https://pkg.go.dev/runtime#Caller
+[`CacheKeys`]:https://pkg.go.dev/github.com/rsteube/carapace/pkg/cache#CacheKey
diff --git a/internal/shell/export/action.go b/internal/shell/export/action.go
index 971e20a..9446298 100644
--- a/internal/shell/export/action.go
+++ b/internal/shell/export/action.go
@@ -3,7 +3,6 @@ package export
 import (
 	"encoding/json"
 	"runtime/debug"
-	"sort"
 
 	"github.com/rsteube/carapace/internal/common"
 )
@@ -15,7 +14,6 @@ type Export struct {
 }
 
 func ActionRawValues(currentWord string, nospace bool, values common.RawValues) string {
-	sort.Sort(common.ByValue(values))
 	m, _ := json.Marshal(Export{
 		Version:   version(),
 		Nospace:   nospace,
diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go
index defe8e0..b9ce303 100644
--- a/internal/shell/zsh/snippet.go
+++ b/internal/shell/zsh/snippet.go
@@ -27,7 +27,7 @@ function _%v_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
-  #zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
+  # TODO for ${curcontext}: zstyle ':completion:*' list-colors "${lines[1]}"
   
   # shellcheck disable=SC2034,2206
   lines=(${lines[@]:1})


Test patch:
diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh
index 28775ce..7dd2ce9 100644
--- a/example/cmd/_test/zsh.sh
+++ b/example/cmd/_test/zsh.sh
@@ -15,7 +15,7 @@ function _example_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
-  #zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
+  # TODO for ${curcontext}: zstyle ':completion:*' list-colors "${lines[1]}"
   
   # shellcheck disable=SC2034,2206
   lines=(${lines[@]:1})