nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: rsteube/carapace
Pull request #505 (2022-04-25 17:34:38)

context: setenv reference


Patch:
diff --git a/action.go b/action.go
index 1d0ddbf..9c6880e 100644
--- a/action.go
+++ b/action.go
@@ -40,12 +40,11 @@ type Context struct {
 }
 
 // Setenv sets the value of the environment variable named by the key.
-func (c Context) Setenv(key, value string) Context {
+func (c *Context) Setenv(key, value string) {
 	if c.Env == nil {
 		c.Env = []string{}
 	}
 	c.Env = append(c.Env, fmt.Sprintf("%v=%v", key, value))
-	return c
 }
 
 // Cache cashes values of a CompletionCallback for given duration and keys


Test patch:
diff --git a/defaultActions_test.go b/defaultActions_test.go
index debe766..c834d28 100644
--- a/defaultActions_test.go
+++ b/defaultActions_test.go
@@ -51,6 +51,8 @@ func TestActionExecCommandEnv(t *testing.T) {
 		return ActionValues()
 	}).Invoke(Context{})
 
+	c := Context{}
+	c.Setenv("carapace_TestActionExecCommand", "test")
 	ActionExecCommand("env")(func(output []byte) Action {
 		lines := strings.Split(string(output), "\n")
 		for _, line := range lines {
@@ -60,5 +62,5 @@ func TestActionExecCommandEnv(t *testing.T) {
 		}
 		t.Error("should contain env carapace_TestActionExecCommand=test")
 		return ActionValues()
-	}).Invoke(Context{}.Setenv("carapace_TestActionExecCommand", "test"))
+	}).Invoke(c)
 }
Repository: rsteube/carapace
Pull request #547 (2022-08-22 10:39:06)

nushell: update snippet
related nushell/nushell#6295


Patch:
diff --git a/README.md b/README.md
index 480beaf..04055c8 100644
--- a/README.md
+++ b/README.md
@@ -59,8 +59,7 @@ set PATH $PATH (pwd)
 example _carapace fish | source
 
 # nushell
-example _carapace nushell | save example.nu
-source example.nu
+example _carapace nushell
 
 # oil
 PATH=$PATH:$(pwd)
diff --git a/docs/src/carapace/gen/hiddenSubcommand.md b/docs/src/carapace/gen/hiddenSubcommand.md
index 21967ba..d112a9f 100644
--- a/docs/src/carapace/gen/hiddenSubcommand.md
+++ b/docs/src/carapace/gen/hiddenSubcommand.md
@@ -22,8 +22,7 @@ eval (command _carapace | slurp)
 command _carapace | source
 
 # nushell
-command _carapace nushell | save out.nu
-source out.nu
+command _carapace nushell
 
 # oil
 source <(command _carapace)
diff --git a/internal/shell/nushell/snippet.go b/internal/shell/nushell/snippet.go
index b46457b..20b7a21 100644
--- a/internal/shell/nushell/snippet.go
+++ b/internal/shell/nushell/snippet.go
@@ -10,20 +10,14 @@ import (
 
 // Snippet creates the nushell completion script
 func Snippet(cmd *cobra.Command) string {
-	return fmt.Sprintf(`module carapace_%v {
-  def "nu-complete %v" [line: string, pos: int] {
-    let words = ($line | str substring [0 $pos] | split row " ")
-    if ($line | str substring [0 $pos] | str ends-with " ") {
-      %v _carapace nushell ($words | append "") | from json
-    } else {
-      %v _carapace nushell $words | from json
-    }
-  }
-  
-  export extern "%v" [
-    ...args: string@"nu-complete %v"
-  ]
+	return fmt.Sprintf(`let external_completer = {|spans| 
+    {
+      $spans.0: { } # default
+      %v: { %v _carapace nushell $spans | from json }
+    } | get $spans.0 | each {|it| do $it}
 }
-use carapace_%v *
-`, cmd.Name(), cmd.Name(), uid.Executable(), uid.Executable(), cmd.Name(), cmd.Name(), cmd.Name())
+
+let-env config = {
+  external_completer: $external_completer
+}`, cmd.Name(), uid.Executable())
 }


Test patch:
diff --git a/example/cmd/_test/nushell.nu b/example/cmd/_test/nushell.nu
index 5bf48b5..d0ca5ec 100644
--- a/example/cmd/_test/nushell.nu
+++ b/example/cmd/_test/nushell.nu
@@ -1,16 +1,10 @@
-module carapace_example {
-  def "nu-complete example" [line: string, pos: int] {
-    let words = ($line | str substring [0 $pos] | split row " ")
-    if ($line | str substring [0 $pos] | str ends-with " ") {
-      example _carapace nushell ($words | append "") | from json
-    } else {
-      example _carapace nushell $words | from json
-    }
-  }
-  
-  export extern "example" [
-    ...args: string@"nu-complete example"
-  ]
+let external_completer = {|spans| 
+    {
+      $spans.0: { } # default
+      example: { example _carapace nushell $spans | from json }
+    } | get $spans.0 | each {|it| do $it}
 }
-use carapace_example *
 
+let-env config = {
+  external_completer: $external_completer
+}
Repository: rsteube/carapace
Pull request #548 (2022-08-22 11:28:41)

nushell: fix indentation


Patch:
diff --git a/internal/shell/nushell/snippet.go b/internal/shell/nushell/snippet.go
index 20b7a21..3881d02 100644
--- a/internal/shell/nushell/snippet.go
+++ b/internal/shell/nushell/snippet.go
@@ -11,10 +11,10 @@ import (
 // Snippet creates the nushell completion script
 func Snippet(cmd *cobra.Command) string {
 	return fmt.Sprintf(`let external_completer = {|spans| 
-    {
-      $spans.0: { } # default
-      %v: { %v _carapace nushell $spans | from json }
-    } | get $spans.0 | each {|it| do $it}
+  {
+    $spans.0: { } # default
+    %v: { %v _carapace nushell $spans | from json }
+  } | get $spans.0 | each {|it| do $it}
 }
 
 let-env config = {


Test patch:
diff --git a/example/cmd/_test/nushell.nu b/example/cmd/_test/nushell.nu
index d0ca5ec..c3cb1a6 100644
--- a/example/cmd/_test/nushell.nu
+++ b/example/cmd/_test/nushell.nu
@@ -1,8 +1,8 @@
 let external_completer = {|spans| 
-    {
-      $spans.0: { } # default
-      example: { example _carapace nushell $spans | from json }
-    } | get $spans.0 | each {|it| do $it}
+  {
+    $spans.0: { } # default
+    example: { example _carapace nushell $spans | from json }
+  } | get $spans.0 | each {|it| do $it}
 }
 
 let-env config = {
Repository: rsteube/carapace
Pull request #604 (2022-11-20 18:36:59)

ActionImport: fix nospace


Patch:
diff --git a/defaultActions.go b/defaultActions.go
index 4fd64ba..fe72d9d 100644
--- a/defaultActions.go
+++ b/defaultActions.go
@@ -68,7 +68,7 @@ func ActionImport(output []byte) Action {
 			return ActionMessage(err.Error())
 		}
 		a := actionRawValues(e.RawValues...)
-		a = a.NoSpace([]rune(e.Nospace)...)
+		a.nospace = e.Nospace
 		return a
 	})
 }


Test patch:
diff --git a/action_test.go b/action_test.go
index dafd77f..6c86a8c 100644
--- a/action_test.go
+++ b/action_test.go
@@ -25,6 +25,7 @@ func assertEqual(t *testing.T, expected, actual InvokedAction) {
 	a, _ := json.MarshalIndent(actual.rawValues, "", "  ")
 
 	assert.Equal(t, string(e), string(a))
+	assert.Equal(t, string(expected.nospace), string(actual.nospace))
 }
 
 func assertNotEqual(t *testing.T, expected, actual InvokedAction) {
@@ -204,7 +205,7 @@ func TestActionFilesChdir(t *testing.T) {
 
 func TestActionMessage(t *testing.T) {
 	assertEqual(t,
-		ActionStyledValuesDescribed("_", "", style.Default, "ERR", "example message", style.Carapace.Error).noSpace("/").skipCache(true).Invoke(Context{}).Prefix("docs/"),
+		ActionStyledValuesDescribed("_", "", style.Default, "ERR", "example message", style.Carapace.Error).noSpace("*").skipCache(true).Invoke(Context{}).Prefix("docs/"),
 		ActionMessage("example message").Invoke(Context{CallbackValue: "docs/"}),
 	)
 }
@@ -215,7 +216,7 @@ func TestActionMessageSuppress(t *testing.T) {
 			ActionMessage("example message").Suppress("example"),
 			ActionValues("test"),
 		).ToA().Invoke(Context{}),
-		ActionValues("test").noSpace("/").skipCache(true).Invoke(Context{}),
+		ActionValues("test").noSpace("*").skipCache(true).Invoke(Context{}), // TODO suppress does not reset nospace (is that even possible?)
 	)
 }
 
diff --git a/defaultActions_test.go b/defaultActions_test.go
index 30f4837..4cb0691 100644
--- a/defaultActions_test.go
+++ b/defaultActions_test.go
@@ -11,7 +11,7 @@ func TestActionImport(t *testing.T) {
 	s := `
 {
   "Version": "unknown",
-  "Nospace": "*",
+  "Nospace": "",
   "RawValues": [
     {
       "Value": "positional1",
@@ -27,7 +27,7 @@ func TestActionImport(t *testing.T) {
     }
   ]
 }`
-	assertEqual(t, ActionValues("positional1", "p1").NoSpace().Invoke(Context{}), ActionImport([]byte(s)).Invoke(Context{}))
+	assertEqual(t, ActionValues("positional1", "p1").Invoke(Context{}), ActionImport([]byte(s)).Invoke(Context{}))
 }
 
 func TestActionFlags(t *testing.T) {
Repository: rsteube/carapace
Pull request #610 (2022-11-24 21:55:22)

zsh: fix conditional nospace


Patch:
diff --git a/internal/shell/zsh/action.go b/internal/shell/zsh/action.go
index 5e9e59b..2f8dd1a 100644
--- a/internal/shell/zsh/action.go
+++ b/internal/shell/zsh/action.go
@@ -78,8 +78,8 @@ func ActionRawValues(currentWord string, nospace common.SuffixMatcher, values co
 	for index, val := range filtered {
 		val.Value = sanitizer.Replace(val.Value)
 		val.Value = quoteValue(val.Value)
-		if nospace.Matches(val.Value) {
-			val.Value = val.Value + "\001"
+		if !nospace.Matches(val.Value) {
+			val.Value = val.Value + " "
 		}
 		val.Display = sanitizer.Replace(val.Display)
 		val.Description = sanitizer.Replace(val.Description)
diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go
index ccfe92d..816a69e 100644
--- a/internal/shell/zsh/snippet.go
+++ b/internal/shell/zsh/snippet.go
@@ -27,22 +27,15 @@ function _%v_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
-  #zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
   
   # shellcheck disable=SC2034,2206
   lines=(${lines[@]:1})
-
   # shellcheck disable=SC2034,2206
-  local vals=(${lines%%%%$'\t'*})
+  local vals=(${lines%%$'\t'*})
   # shellcheck disable=SC2034,2206
   local displays=(${lines##*$'\t'})
 
-  local suffix=' '
-  [[ ${vals[1]} == *$'\001' ]] && suffix=''
-  # shellcheck disable=SC2034,2206
-  vals=(${vals%%%%$'\001'*})
-
-  compadd -Q -S "${suffix}" -d displays -a -- vals
+  compadd -Q -S '' -a -d displays -- vals
 }
 compquote '' 2>/dev/null && _%v_completion
 compdef _%v_completion %v


Test patch:
diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh
index 48be4b4..03ca790 100644
--- a/example/cmd/_test/zsh.sh
+++ b/example/cmd/_test/zsh.sh
@@ -15,22 +15,15 @@ function _example_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
-  #zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
   
   # shellcheck disable=SC2034,2206
   lines=(${lines[@]:1})
-
   # shellcheck disable=SC2034,2206
-  local vals=(${lines%%$'\t'*})
+  local vals=(${lines%$'\t'*})
   # shellcheck disable=SC2034,2206
   local displays=(${lines##*$'\t'})
 
-  local suffix=' '
-  [[ ${vals[1]} == *$'\001' ]] && suffix=''
-  # shellcheck disable=SC2034,2206
-  vals=(${vals%%$'\001'*})
-
-  compadd -Q -S "${suffix}" -d displays -a -- vals
+  compadd -Q -S '' -a -d displays -- vals
 }
 compquote '' 2>/dev/null && _example_completion
 compdef _example_completion example
Repository: rsteube/carapace
Pull request #624 (2022-11-27 22:24:50)

zsh: usage support
related #584


Patch:
diff --git a/internal/shell/zsh/action.go b/internal/shell/zsh/action.go
index b6bcc6a..8ef7c66 100644
--- a/internal/shell/zsh/action.go
+++ b/internal/shell/zsh/action.go
@@ -93,7 +93,11 @@ func ActionRawValues(currentWord string, usage string, nospace common.SuffixMatc
 	if len(zstyles) > 1000 { // TODO disable styling for large amount of values (bad performance)
 		zstyles = make([]string, 0)
 	}
-	return fmt.Sprintf(":%v\n%v", strings.Join(zstyles, ":"), strings.Join(vals, "\n"))
+
+	if usage == "" {
+		usage = "NONE" // TODO fix empty line issue in script
+	}
+	return fmt.Sprintf(":%v\n%v\n%v", strings.Join(zstyles, ":"), usage, strings.Join(vals, "\n"))
 }
 
 var zstyleQuoter = strings.NewReplacer(
diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go
index 816a69e..edac388 100644
--- a/internal/shell/zsh/snippet.go
+++ b/internal/shell/zsh/snippet.go
@@ -27,9 +27,10 @@ function _%v_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
+  [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]}"
   
   # shellcheck disable=SC2034,2206
-  lines=(${lines[@]:1})
+  lines=(${lines[@]:2})
   # shellcheck disable=SC2034,2206
   local vals=(${lines%%$'\t'*})
   # shellcheck disable=SC2034,2206


Test patch:
diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh
index 03ca790..0e6232b 100644
--- a/example/cmd/_test/zsh.sh
+++ b/example/cmd/_test/zsh.sh
@@ -15,9 +15,10 @@ function _example_completion {
   fi
 
   export ZLS_COLOURS="${lines[1]}"
+  [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]}"
   
   # shellcheck disable=SC2034,2206
-  lines=(${lines[@]:1})
+  lines=(${lines[@]:2})
   # shellcheck disable=SC2034,2206
   local vals=(${lines%$'\t'*})
   # shellcheck disable=SC2034,2206
Repository: rsteube/carapace
Pull request #636 (2022-12-04 14:23:26)

zsh: fix zstyle not matching first entry


Patch:
diff --git a/internal/shell/zsh/action.go b/internal/shell/zsh/action.go
index f326219..67cdcc3 100644
--- a/internal/shell/zsh/action.go
+++ b/internal/shell/zsh/action.go
@@ -74,5 +74,5 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
 			vals[index] = fmt.Sprintf("%v\t%v:%v", val.Value, val.Display, val.TrimmedDescription())
 		}
 	}
-	return fmt.Sprintf(":%v\n%v\n%v", zstyles{values}.Format(), message{meta}.Format(), strings.Join(vals, "\n"))
+	return fmt.Sprintf("%v\n%v\n%v", zstyles{values}.Format(), message{meta}.Format(), strings.Join(vals, "\n"))
 }
diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go
index 1ef4e45..e19b2ff 100644
--- a/internal/shell/zsh/snippet.go
+++ b/internal/shell/zsh/snippet.go
@@ -26,7 +26,7 @@ function _%v_completion {
     local lines=($(echo ${words} | sed 's/$/"/' | CARAPACE_ZSH_HASH_DIRS="$(hash -d)" xargs %v _carapace zsh))
   fi
 
-  zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}":
+  zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
 
   local line_break=$'\n'
   [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]//$'\t'/${line_break}}"


Test patch:
diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh
index 8188e35..43dfeae 100644
--- a/example/cmd/_test/zsh.sh
+++ b/example/cmd/_test/zsh.sh
@@ -14,7 +14,7 @@ function _example_completion {
     local lines=($(echo ${words} | sed 's/$/"/' | CARAPACE_ZSH_HASH_DIRS="$(hash -d)" xargs example _carapace zsh))
   fi
 
-  zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}":
+  zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}"
 
   local line_break=$'\n'
   [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]//$'\t'/${line_break}}"
Repository: rsteube/carapace
Pull request #677 (2023-01-07 11:19:08)

export: renamed field to values


Patch:
diff --git a/defaultActions.go b/defaultActions.go
index 5b06799..8e1c4e6 100644
--- a/defaultActions.go
+++ b/defaultActions.go
@@ -63,7 +63,7 @@ func ActionImport(output []byte) Action {
 			return ActionMessage(err.Error())
 		}
 		return Action{
-			rawValues: e.RawValues,
+			rawValues: e.Values,
 			meta:      e.Meta,
 		}
 	})
diff --git a/example/cmd/action.go b/example/cmd/action.go
index a254a1b..15211aa 100644
--- a/example/cmd/action.go
+++ b/example/cmd/action.go
@@ -52,7 +52,7 @@ func init() {
 {
   "Version": "unknown",
   "Nospace": "",
-  "RawValues": [
+  "Values": [
     {
       "Value": "first",
       "Display": "first"
diff --git a/internal/shell/export/action.go b/internal/shell/export/action.go
index e2b27cb..5e3d7cb 100644
--- a/internal/shell/export/action.go
+++ b/internal/shell/export/action.go
@@ -11,15 +11,15 @@ import (
 type Export struct {
 	Version string
 	common.Meta
-	RawValues common.RawValues
+	Values common.RawValues
 }
 
 func ActionRawValues(currentWord string, meta common.Meta, values common.RawValues) string {
 	sort.Sort(common.ByValue(values))
 	m, _ := json.Marshal(Export{
-		Version:   version(),
-		Meta:      meta,
-		RawValues: values,
+		Version: version(),
+		Meta:    meta,
+		Values:  values,
 	})
 	return string(m)
 }


Test patch:
diff --git a/defaultActions_test.go b/defaultActions_test.go
index 9ffff9f..4afe925 100644
--- a/defaultActions_test.go
+++ b/defaultActions_test.go
@@ -12,7 +12,7 @@ func TestActionImport(t *testing.T) {
 {
   "Version": "unknown",
   "Nospace": "",
-  "RawValues": [
+  "Values": [
     {
       "Value": "positional1",
       "Display": "positional1",
Repository: rsteube/carapace
Pull request #730 (2023-02-18 15:59:00)

nushell: setup changes since nushell 0.72
related rsteube/carapace-bin#1516


Patch:
diff --git a/internal/shell/nushell/snippet.go b/internal/shell/nushell/snippet.go
index 5e42415..72357e4 100644
--- a/internal/shell/nushell/snippet.go
+++ b/internal/shell/nushell/snippet.go
@@ -18,6 +18,11 @@ func Snippet(cmd *cobra.Command) string {
 }
 
 let-env config = {
-  external_completer: $external_completer
+  completions: {
+    external: {
+      enable: true
+      completer: $external_completer
+    }
+  }
 }`, cmd.Name(), uid.Executable())
 }


Test patch:
diff --git a/example/cmd/_test/nushell.nu b/example/cmd/_test/nushell.nu
index c3cb1a6..0c0e5b8 100644
--- a/example/cmd/_test/nushell.nu
+++ b/example/cmd/_test/nushell.nu
@@ -6,5 +6,10 @@ let external_completer = {|spans|
 }
 
 let-env config = {
-  external_completer: $external_completer
+  completions: {
+    external: {
+      enable: true
+      completer: $external_completer
+    }
+  }
 }
Repository: rsteube/carapace
Pull request #750 (2023-04-02 07:46:33)

flag bool optarg
- gh-pages: fix path
- flags: support optarg completion for bool flags as well



Patch:
diff --git a/docs/src/carapace.md b/docs/src/carapace.md
index caee0ae..74eb95f 100644
--- a/docs/src/carapace.md
+++ b/docs/src/carapace.md
@@ -5,7 +5,7 @@
 - [Bash](https://www.gnu.org/software/bash/)
 - [Elvish](https://elv.sh/)
 - [Fish](https://fishshell.com/)
-- [Ion](https://doc.redox-os.org/ion-manual/) ([experimental](https://github.com/rsteube/carapace/issues/88))
+- [Ion](https://doc.redox-os.org/ion-manual/html/) ([experimental](https://github.com/rsteube/carapace/issues/88))
 - [Nushell](https://www.nushell.sh/)
 - [Oil](http://www.oilshell.org/)
 - [Powershell](https://microsoft.com/powershell)
diff --git a/traverse.go b/traverse.go
index faaa138..beb9970 100644
--- a/traverse.go
+++ b/traverse.go
@@ -6,6 +6,7 @@ import (
 	"github.com/rsteube/carapace/internal/common"
 	"github.com/rsteube/carapace/internal/config"
 	"github.com/rsteube/carapace/internal/pflagfork"
+	"github.com/rsteube/carapace/pkg/style"
 	"github.com/spf13/cobra"
 )
 
@@ -161,7 +162,13 @@ loop:
 			LOG.Printf("completing optional flag argument for arg %#v\n", context.CallbackValue)
 			prefix, optarg := f.Split(context.CallbackValue)
 			context.CallbackValue = optarg
-			return storage.getFlag(c, f.Name).Prefix(prefix), context
+
+			switch f.Value.Type() {
+			case "bool":
+				return ActionValues("true", "false").StyleF(style.ForKeyword).Prefix(prefix), context
+			default:
+				return storage.getFlag(c, f.Name).Prefix(prefix), context
+			}
 		}
 		LOG.Printf("completing flags for arg %#v\n", context.CallbackValue)
 		return actionFlags(c), context


Test patch:
diff --git a/example/cmd/root_test.go b/example/cmd/root_test.go
index 8942a6d..a94f42b 100644
--- a/example/cmd/root_test.go
+++ b/example/cmd/root_test.go
@@ -128,5 +128,11 @@ func TestRoot(t *testing.T) {
 			Expect(carapace.ActionStyledValuesDescribed(
 				"--array", "multiflag", style.Blue,
 			).NoSpace('.').Tag("flags"))
+
+		s.Run("--toggle=").
+			Expect(carapace.ActionStyledValues(
+				"false", style.Red,
+				"true", style.Green,
+			).Prefix("--toggle="))
 	})
 }
Repository: rsteube/carapace
Pull request #775 (2023-05-07 09:25:57)

example: added ActionPositional


Patch:
diff --git a/example/cmd/action.go b/example/cmd/action.go
index cca496c..72b2ae8 100644
--- a/example/cmd/action.go
+++ b/example/cmd/action.go
@@ -132,12 +132,7 @@ func init() {
 		),
 	})
 
-	carapace.Gen(actionCmd).PositionalCompletion(
-		carapace.ActionValues("positional1", "p1", "positional1 with space"),
-		carapace.ActionValues("positional2", "p2", "positional2 with space"),
-	)
-
-	carapace.Gen(actionCmd).DashAnyCompletion(
+	carapace.Gen(actionCmd).PositionalAnyCompletion(
 		carapace.ActionCallback(func(c carapace.Context) carapace.Action {
 			cmd := &cobra.Command{
 				Use: "embedded",
@@ -160,10 +155,14 @@ func init() {
 
 			carapace.Gen(cmd).PositionalCompletion(
 				carapace.ActionValues("embeddedPositional1", "embeddedP1"),
-				carapace.ActionValues("embeddedPositional2", "embeddedP2"),
+				carapace.ActionValues("embeddedPositional2 with space", "embeddedP2 with space"),
 			)
 
 			return carapace.ActionExecute(cmd)
 		}),
 	)
+
+	carapace.Gen(actionCmd).DashAnyCompletion(
+		carapace.ActionPositional(actionCmd),
+	)
 }


Test patch:
diff --git a/example/cmd/action_test.go b/example/cmd/action_test.go
index c15f617..c192333 100644
--- a/example/cmd/action_test.go
+++ b/example/cmd/action_test.go
@@ -151,12 +151,12 @@ func TestAction(t *testing.T) {
 			Expect(carapace.ActionValuesDescribed("third", "description of third").
 				Usage("ActionValuesDescribed()"))
 
-		s.Run("action", "pos").
-			Expect(carapace.ActionValues("positional1", "positional1 with space").
+		s.Run("action", "embe").
+			Expect(carapace.ActionValues("embeddedP1", "embeddedPositional1").
 				Usage("action [pos1] [pos2] [--] [dashAny]..."))
 
-		s.Run("action", "p1", "positional2 ").
-			Expect(carapace.ActionValues("positional2 with space").
+		s.Run("action", "embeddedP1", "embeddedP2 ").
+			Expect(carapace.ActionValues("embeddedP2 with space").
 				Usage("action [pos1] [pos2] [--] [dashAny]..."))
 
 		s.Run("action", "--unknown", "").
@@ -200,8 +200,8 @@ func TestDash(t *testing.T) {
 			Expect(carapace.ActionValues("es1", "es2", "es3").
 				Usage("embedded string flag"))
 
-		s.Run("action", "p1", "--styled-values", "second", "p2", "--", "embeddedP1", "--embedded-string", "es1", "").
-			Expect(carapace.ActionValues("embeddedPositional2", "embeddedP2").
+		s.Run("action", "embeddedP1", "--styled-values", "second", "--", "--embedded-string", "es1", "").
+			Expect(carapace.ActionValues("embeddedP2 with space", "embeddedPositional2 with space").
 				Usage("action [pos1] [pos2] [--] [dashAny]..."))
 	})
 }
@@ -213,7 +213,7 @@ func TestUnknownFlag(t *testing.T) {
 
 		s.Env("CARAPACE_LENIENT", "1")
 		s.Run("action", "--unknown", "").
-			Expect(carapace.ActionValues("p1", "positional1", "positional1 with space").
+			Expect(carapace.ActionValues("embeddedP1", "embeddedPositional1").
 				Usage("action [pos1] [pos2] [--] [dashAny]..."))
 	})
 }