Skip to content

feat: default argument values for slash commands#217

Open
ariane-emory wants to merge 10 commits intodevfrom
feat/default-arguments
Open

feat: default argument values for slash commands#217
ariane-emory wants to merge 10 commits intodevfrom
feat/default-arguments

Conversation

@ariane-emory
Copy link
Owner

@ariane-emory ariane-emory commented Feb 24, 2026

Issue for this PR

Closes #213

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a new syntax for providing default values for the arguments of custom slash commands that is used if the argument returns an empty string. Defaults may be other simple arguments and are chainable.

Compatible with (but does not require) the feat/argument-ranges branch.

Examples

${2:default} returns either the second actual argument or, if empty, a default string, "default".
${3:$2:default} returns either the third argument or, if empty, the second argument, or if the second argument is also empty a default string, "default".

ariane-emory and others added 8 commits February 16, 2026 11:02
Extracts argument substitution logic from session/prompt.ts to
config/substitute.ts for reuse by other features like the expand
command.

Handles:
- $1, $2, etc. positional arguments (last one swallows remaining)
- $ARGUMENTS placeholder (all args joined)
Supports syntax like ${2:foobar} where the default value is used
if the argument is missing, empty, or whitespace-only.
@ariane-emory ariane-emory changed the title feat: default arguments in slash commands feat: default argument values for slash commands Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Default argument values in custom slash commands and (opencode expand).

1 participant