feat(directory): add support for regexes in substitutions (#7145)

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
Christophe Henry
2026-01-25 22:09:09 +01:00
committed by GitHub
parent 70b0f73554
commit 2e8f26e448
4 changed files with 214 additions and 31 deletions
+46 -13
View File
@@ -367,7 +367,7 @@
"default": {
"truncation_length": 3,
"truncate_to_repo": true,
"substitutions": {},
"substitutions": [],
"fish_style_pwd_dir_length": 0,
"use_logical_path": true,
"format": "[$path]($style)[$read_only]($read_only_style) ",
@@ -2668,11 +2668,8 @@
"default": true
},
"substitutions": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"default": {}
"$ref": "#/$defs/Either",
"default": []
},
"fish_style_pwd_dir_length": {
"type": "integer",
@@ -2736,6 +2733,42 @@
},
"additionalProperties": false
},
"Either": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/$defs/SubstitutionConfig"
}
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
]
},
"SubstitutionConfig": {
"type": "object",
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"regex": {
"type": "boolean",
"default": false
}
},
"additionalProperties": false,
"required": [
"from",
"to"
]
},
"DirenvConfig": {
"type": "object",
"properties": {
@@ -5413,7 +5446,7 @@
"type": "object",
"properties": {
"pixi_binary": {
"$ref": "#/$defs/Either",
"$ref": "#/$defs/Either2",
"default": [
"pixi"
]
@@ -5469,7 +5502,7 @@
},
"additionalProperties": false
},
"Either": {
"Either2": {
"anyOf": [
{
"type": "string"
@@ -5577,7 +5610,7 @@
"default": "pyenv "
},
"python_binary": {
"$ref": "#/$defs/Either",
"$ref": "#/$defs/Either2",
"default": [
[
"python"
@@ -6187,7 +6220,7 @@
"default": "S "
},
"compiler": {
"$ref": "#/$defs/Either",
"$ref": "#/$defs/Either2",
"default": [
"solc"
]
@@ -6893,7 +6926,7 @@
"default": ""
},
"when": {
"$ref": "#/$defs/Either2",
"$ref": "#/$defs/Either3",
"default": false
},
"require_repo": {
@@ -6901,7 +6934,7 @@
"default": false
},
"shell": {
"$ref": "#/$defs/Either",
"$ref": "#/$defs/Either2",
"default": []
},
"description": {
@@ -6960,7 +6993,7 @@
},
"additionalProperties": false
},
"Either2": {
"Either3": {
"anyOf": [
{
"type": "boolean"