Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/env/test_env_file
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cat <<EOF >mise.toml
[[env]]
_.file = 'a'
[[env]]
_.file = [{ path = 'b.json', tools = true }]
_.file = [{ path = ['b.json'], tools = true }]
EOF
echo 'export A=1' >a
echo '{"B": 2}' >b.json
Expand Down
52 changes: 52 additions & 0 deletions e2e/env/test_env_path
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,65 @@ assert_contains "mise env -s bash | grep PATH" "/installs/dummy/2.0.0/bin"

assert_contains "mise env -s bash dummy@1.0.1 | grep PATH" "/installs/dummy/1.0.1/bin"

cat <<'EOF' >mise.toml
[env]
_.path = 'a'
EOF
assert "mise dr path" "$PWD/a"

cat <<'EOF' >mise.toml
[env]
_.path = ['a', 'b']
EOF
assert "mise dr path" "$PWD/a
$PWD/b"

cat <<'EOF' >mise.toml
[env]
_.path = { path = "a", tools = true }
EOF
assert "mise dr path" "$PWD/a"

cat <<'EOF' >mise.toml
[env]
_.path = { path = ["a"], tools = true }
EOF
assert "mise dr path" "$PWD/a"

cat <<'EOF' >mise.toml
[env]
_.path = [{ path = "a", tools = true }, "b"]
EOF
assert "mise dr path" "$PWD/a
$PWD/b"

cat <<'EOF' >mise.toml
[env]
_.path = { path = "a", tools = true }
EOF
assert "mise dr path" "$PWD/a"

cat <<'EOF' >mise.toml
[env]
_.path = [{ path = ["a", "b"], tools = true }]
EOF
assert "mise dr path" "$PWD/a
$PWD/b"

cat <<'EOF' >mise.toml
[[env]]
_.path = [{ path = "a", tools = true }, "b"]
[[env]]
_.path = "c"
EOF
assert "mise dr path" "$PWD/a
$PWD/b
$PWD/c"

cat <<'EOF' >mise.toml
[env]
_.path = ['a', 'b']
EOF
mkdir -p sub_dir
cd sub_dir
cat <<'EOF' >mise.toml
Expand Down
168 changes: 95 additions & 73 deletions schema/mise-task.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,32 @@
"additionalProperties": true,
"properties": {
"file": {
"oneOf": [
{
"$ref": "#/$defs/env_directive"
},
{
"description": "dotenv file to load",
"type": "string"
},
{
"description": "dotenv files to load",
"type": "array",
"items": {
"oneOf": [
{
"description": "dotenv file to load",
"type": "string"
},
{
"$ref": "#/$defs/env_directive"
}
]
}
}
]
},
"path": {
"oneOf": [
{
"type": "object",
Expand All @@ -380,27 +406,37 @@
}
]
},
"paths": {
"type": "array",
"items": {
"type": "string"
}
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
}
},
"oneOf": [
{
"required": ["path"]
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
{
"required": ["paths"]
}
}
]
},
{
"description": "dotenv file to load",
"description": "PATH entry to add",
"type": "string"
},
{
"description": "dotenv files to load",
"description": "PATH entries to add",
"type": "array",
"items": {
"oneOf": [
{
"description": "dotenv file to load",
"description": "PATH entry to add",
"type": "string"
},
{
Expand All @@ -422,10 +458,6 @@
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
}
Expand All @@ -434,40 +466,6 @@
}
]
},
"path": {
"oneOf": [
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
},
{
"description": "PATH entry to add",
"type": "string"
},
{
"description": "PATH entries to add",
"items": {
"description": "PATH entry to add",
"type": "string"
},
"type": "array"
}
]
},
"python": {
"description": "python environment",
"properties": {
Expand Down Expand Up @@ -519,42 +517,26 @@
"source": {
"oneOf": [
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
"$ref": "#/$defs/env_directive"
},
{
"description": "bash script to load",
"type": "string"
},
{
"description": "bash scripts to load",
"type": "array",
"items": {
"description": "bash script to load",
"type": "string"
},
"type": "array"
"oneOf": [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add this as a $def?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, not using it for env._.path as redact shouldn't be shown in the suggestion.
It's allowed in the Rust code but shouldn't be allowed in the schema.

{
"description": "bash script to load",
"type": "string"
},
{
"$ref": "#/$defs/env_directive"
}
]
}
}
]
}
Expand All @@ -563,6 +545,46 @@
}
},
"type": "object"
},
"env_directive": {
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"paths": {
"type": "array",
"items": {
"type": "string"
}
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
},
"oneOf": [
{
"required": ["path"]
},
{
"required": ["paths"]
}
]
}
},
"description": "Config file for included mise tasks (https://mise.jdx.dev/tasks/#task-configuration)",
Expand Down
Loading
Loading