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 .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
indent_style = space
indent_size = 4

[{*.sh,.mise/tasks/**/*,e2e/**/*}]
[{*.sh,.mise/tasks/**/*,e2e/**/*,*.pkl}]
indent_style = space
indent_size = 2

Expand Down
1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
disable=SC1008
disable=SC2088
disable=SC2164
disable=SC2317
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ min_version = '2024.11.1'

### `mise.toml` schema

- You can find the JSON schema for `mise.toml` [here](https://github.com/jdx/mise/blob/main/schema/mise.json) or at <https://mise.jdx.dev/schema/mise.json>.
- You can find the JSON schema for `mise.toml` in [schema/mise.json](https://github.com/jdx/mise/blob/main/schema/mise.json) or at <https://mise.jdx.dev/schema/mise.json>.
- Some editors can load it automatically to provide autocompletion and validation for when editing a `mise.toml` file ([VSCode](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings), [IntelliJ](https://www.jetbrains.com/help/idea/json.html#ws_json_using_schemas), [neovim](https://github.com/b0o/SchemaStore.nvim), etc.). It is also available in the [JSON schema store](https://www.schemastore.org/json/).
- Note that for `included tasks` (see [task configuration](/tasks/task-configuration), there is another schema: <https://mise.jdx.dev/schema/mise-task.json>)

Expand Down
2 changes: 1 addition & 1 deletion docs/dev-tools/backends/pipx.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mise use -g python
pip install --user pipx
```

Other installation instructions can be found [here](https://pipx.pypa.io/latest/installation/)
[Other installation instructions](https://pipx.pypa.io/latest/installation/)

## Usage

Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ We maintain [an index](https://github.com/mise-plugins/registry) of shorthands t
base.
This is regularly updated every time that mise has a release. This repository is stored directly
into
the codebase [here](https://github.com/jdx/mise/blob/main/registry.toml).
the codebase in [registry.toml](https://github.com/jdx/mise/blob/main/registry.toml).

## Does "node@20" mean the newest available version of node?

Expand Down
2 changes: 1 addition & 1 deletion docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Tera also supports powerful [expressions](https://keats.github.io/tera/docs/#exp
- in checking, e.g. <span v-pre>`{{ some_var in [1, 2, 3] }}`</span>

Tera also supports control structures such as <span v-pre>`if`</span> and
<span v-pre>`for`</span>. Read more [here](https://keats.github.io/tera/docs/#control-structures).
<span v-pre>`for`</span>. [Read more](https://keats.github.io/tera/docs/#control-structures).

### Tera Filters

Expand Down
16 changes: 8 additions & 8 deletions e2e/assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fail() {
}

# Safeguard against running the test directly, which would execute in the actual user home
[[ -n "${TEST_NAME:-}" ]] || fail "tests should be called using run_test"
[[ -n ${TEST_NAME:-} ]] || fail "tests should be called using run_test"

quiet_assert_succeed() {
local status=0
Expand Down Expand Up @@ -37,7 +37,7 @@ assert_succeed() {
assert_fail() {
local actual
actual="$(quiet_assert_fail "$1")"
if [[ -z "${2:-}" ]]; then
if [[ -z ${2:-} ]]; then
ok "[$1] expected failure"
elif [[ $actual == *"$2"* ]]; then
ok "[$1] output is equal to '$2'"
Expand All @@ -49,7 +49,7 @@ assert_fail() {
assert() {
local actual
actual="$(quiet_assert_succeed "$1")"
if [[ -z "${2:-}" ]]; then
if [[ -z ${2:-} ]]; then
ok "[$1]"
elif [[ $actual == "$2" ]]; then
ok "[$1] output is equal to '$2'"
Expand Down Expand Up @@ -89,7 +89,7 @@ assert_json_partial_array() {
actual_filtered="$(jq -S "$filter" <<<"$actual")"
expected_filtered="$(jq -S "$filter" <<<"$expected")"

if [[ "$actual_filtered" == "$expected_filtered" ]]; then
if [[ $actual_filtered == "$expected_filtered" ]]; then
ok "[$command] partial array match successful"
else
echo "Expected:"
Expand All @@ -113,7 +113,7 @@ assert_json_partial_object() {
actual_filtered="$(jq -S --arg fields "$fields" "$filter" <<<"$actual")"
expected_filtered="$(jq -S --arg fields "$fields" "$filter" <<<"$expected")"

if [[ "$actual_filtered" == "$expected_filtered" ]]; then
if [[ $actual_filtered == "$expected_filtered" ]]; then
ok "[$command] partial object match successful"
else
echo "Expected:"
Expand Down Expand Up @@ -168,23 +168,23 @@ assert_matches() {
assert_empty() {
local actual
actual="$(quiet_assert_succeed "$1")"
if [[ -z "$actual" ]]; then
if [[ -z $actual ]]; then
ok "[$1] output is empty"
else
fail "[$1] expected empty output but got '$actual'"
fi
}

assert_directory_exists() {
if [[ -d "$1" ]]; then
if [[ -d $1 ]]; then
ok "[$1] directory exists"
else
fail "[$1] directory does not exist"
fi
}

assert_directory_not_exists() {
if [[ ! -d "$1" ]]; then
if [[ ! -d $1 ]]; then
ok "[$1] directory does not exist"
else
fail "[$1] directory exists"
Expand Down
2 changes: 1 addition & 1 deletion e2e/backend/test_ubi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assert_contains "$MISE_DATA_DIR/shims/jc --version" "jc version: 1.25.3"

# only run on linux/amd64
if [ "$(uname -m)" = "x86_64" ] && [ "$(uname -s)" = "Linux" ]; then
mise use ubi:https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz[exe=ffmpeg]
mise use 'ubi:https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz[exe=ffmpeg]'
assert_contains "$MISE_DATA_DIR/shims/ffmpeg -version" "ffmpeg version"
fi

Expand Down
1 change: 0 additions & 1 deletion e2e/cli/test_activate_aggressive
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash

ORIG_PATH="$PATH"
eval "$(mise activate bash)"
export PATH="/added:$PATH"

Expand Down
2 changes: 1 addition & 1 deletion e2e/cli/test_settings_ls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

echo "settings.all_compile = false" >mise.toml
echo "settings.disable_backends = [\"rust\", \"java\"]" >>mise.toml
echo 'settings.disable_backends = ["rust", "java"]' >>mise.toml

assert_contains "mise settings" 'all_compile false ~/workdir/mise.toml
disable_backends ["rust", "java"] ~/workdir/mise.toml'
Expand Down
1 change: 1 addition & 0 deletions e2e/config/test_config_env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2209

echo "tools.dummy = '1'" >mise.toml
echo "tools.dummy = '2'" >mise.test.toml
Expand Down
2 changes: 1 addition & 1 deletion e2e/core/test_bun
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ mise i
assert_contains "mise x bun -- bun -v" "1.1.21"

require_cmd node
assert_contains "mise x bun -- bunx cowsay \"hello world\"" "hello world"
assert_contains 'mise x bun -- bunx cowsay "hello world"' "hello world"
2 changes: 1 addition & 1 deletion e2e/core/test_deno
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ "${MISE_DISABLE_TOOLS:-}" = *deno* ]]; then
if [[ ${MISE_DISABLE_TOOLS:-} == *deno* ]]; then
warn "Skipping deno tests"
exit 0
fi
Expand Down
4 changes: 2 additions & 2 deletions e2e/core/test_java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ cat <<EOF >.sdkmanrc
java=17.0.2
EOF
mise i java
assert_contains "mise x java -- java -version 2>&1" "openjdk version \"17.0.2\""
assert_contains "mise x java -- java -version 2>&1" 'openjdk version "17.0.2"'
rm .sdkmanrc

cat <<EOF >.java-version
17.0.2
EOF
assert_contains "mise x java -- java -version 2>&1" "openjdk version \"17.0.2\""
assert_contains "mise x java -- java -version 2>&1" 'openjdk version "17.0.2"'
rm .java-version
9 changes: 5 additions & 4 deletions e2e/env/test_env_template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2016

cat <<EOF >mise.toml
[env]
Expand Down Expand Up @@ -33,10 +34,10 @@ echo "{% raw %}{{ env.FOO }}{% endraw %}: {{ env.FOO }}"
echo "{% raw %}{{ env.BAR }}{% endraw %}: {{ env.BAR }}"
"""
EOF
assert "mise run --trace foo" "\$FOO: foo
\$BAR: bar
assert "mise run --trace foo" '$FOO: foo
$BAR: bar
{{ env.FOO }}: foo
{{ env.BAR }}: bar"
{{ env.BAR }}: bar'

cat <<EOF >mise.toml
[env]
Expand All @@ -48,7 +49,7 @@ env.BAZ = "{{ env.BAR }}"

run = "printf '\$BAZ: %s\n' \$BAZ"
EOF
assert "mise run --trace foo" "\$BAZ: foo"
assert "mise run --trace foo" '$BAZ: foo'

cat <<EOF >mise.toml
[env]
Expand Down
63 changes: 32 additions & 31 deletions e2e/generate/test_generate_devcontainer
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
#!/usr/bin/env bash
# shellcheck disable=SC2016

# Default devcontainer

assert_json_partial_object "mise generate devcontainer" "name,description,features,mounts,containerEnv,customizations" "
assert_json_partial_object "mise generate devcontainer" "name,description,features,mounts,containerEnv,customizations" '
{
\"name\": \"mise\",
\"image\": \"mcr.microsoft.com/devcontainers/base:ubuntu\",
\"features\": {
\"ghcr.io/devcontainers-extra/features/mise:1\": {}
"name": "mise",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers-extra/features/mise:1": {}
},
\"customizations\": {
\"vscode\": {
\"extensions\": [
\"hverlin.mise-vscode\"
"customizations": {
"vscode": {
"extensions": [
"hverlin.mise-vscode"
]
}
},
\"mounts\": [],
\"containerEnv\": {}
"mounts": [],
"containerEnv": {}
}
"
'

# With custom name and image
assert_json_partial_object "mise generate devcontainer --name test --image testimage:latest" "name,description" "
assert_json_partial_object "mise generate devcontainer --name test --image testimage:latest" "name,description" '
{
\"name\": \"test\",
\"image\": \"testimage:latest\"
"name": "test",
"image": "testimage:latest"
}
"
'

# With mount
assert_json_partial_object "mise generate devcontainer --mount-mise-data" "name,description,features,mounts,containerEnv,postCreateCommand" "
assert_json_partial_object "mise generate devcontainer --mount-mise-data" "name,description,features,mounts,containerEnv,postCreateCommand" '
{
\"name\": \"mise\",
\"image\": \"mcr.microsoft.com/devcontainers/base:ubuntu\",
\"features\": {
\"ghcr.io/devcontainers-extra/features/mise:1\": {}
"name": "mise",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers-extra/features/mise:1": {}
},
\"mounts\": [
"mounts": [
{
\"source\": \"mise-data-volume\",
\"target\": \"/mnt/mise-data\",
\"type\": \"volume\"
"source": "mise-data-volume",
"target": "/mnt/mise-data",
"type": "volume"
}
],
\"containerEnv\": {
\"MISE_DATA_DIR\": \"/mnt/mise-data\"
"containerEnv": {
"MISE_DATA_DIR": "/mnt/mise-data"
},
\"remoteEnv\": {
\"PATH\": \"\${containerEnv:PATH}:/mnt/mise-data/shims\"
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/mnt/mise-data/shims"
},
\"postCreateCommand\": \"sudo chown -R vscode:vscode /mnt/mise-data\"
"postCreateCommand": "sudo chown -R vscode:vscode /mnt/mise-data"
}
"
'
4 changes: 2 additions & 2 deletions e2e/run_all_tests
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ for index in "${!FILES[@]}"; do
TEST_NAME="${FILES[$index]}"

# split tests into tranches to reduce test time
if [[ -n "${TEST_TRANCHE_COUNT:-}" ]]; then
if [[ -n ${TEST_TRANCHE_COUNT:-} ]]; then
if [[ $((index % TEST_TRANCHE_COUNT)) -ne $TEST_TRANCHE ]]; then
continue
fi
fi

# Skip slow tests unless TEST_ALL == 1
if [[ ${TEST_ALL:-0} != 1 && $TEST_NAME = *_slow ]]; then
if [[ ${TEST_ALL:-0} != 1 && $TEST_NAME == *_slow ]]; then
# title="E2E test $TEST_NAME skipped" file="e2e/$TEST_NAME" warn "slow tests are disabled"
skipped_count=$((skipped_count + 1))
summary "$TEST_NAME" "-" ":zap:"
Expand Down
2 changes: 1 addition & 1 deletion e2e/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ run_test() {

echo "$TEST: $DURATION" >&2

if [[ "$status" == 0 ]]; then
if [[ $status == 0 ]]; then
remove_isolated_env
summary "$TEST" "$DURATION" ":white_check_mark:"
else
Expand Down
3 changes: 2 additions & 1 deletion e2e/shell/zsh_script
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env zsh
# shellcheck disable=SC1071
set -euo pipefail
orig_path="$PATH"

Expand All @@ -18,7 +19,7 @@ assert_path() {
local actual="${PATH/%$orig_path/}"
actual="${actual//$HOME/\~}"
actual="${actual/%:/}"
if [[ "$actual" != "$expected" ]]; then
if [[ $actual != "$expected" ]]; then
echo "Invalid PATH: $actual"
echo "Expected PATH: $expected"
exit 1
Expand Down
1 change: 1 addition & 0 deletions e2e/sync/test_sync_nvm_slow
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC1091

export NVM_DIR="$PWD/.nvm"
mkdir -p "$NVM_DIR"
Expand Down
24 changes: 22 additions & 2 deletions hk.pkl
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
amends "package://github.com/jdx/hk/releases/download/v1.0.0/hk@1.0.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.0.0/hk@1.0.0#/Builtins.pkl"

local bash_glob = List("*.sh", "xtasks/**", "scripts/**", "e2e/**")
local bash_exclude = List("*.ps1", "*.fish", "*.ts", "*.js", "*.json", "*.bat", "**/.*", "src/assets/bash_zsh_support/**")
local linters = new Mapping<String, Step> {
// uses builtin prettier linter config
["prettier"] = Builtins.prettier
["clippy"] = (Builtins.cargo_clippy) {
check = "cargo clippy --manifest-path {{workspace_indicator}} --all-features --allow-dirty --allow-staged"
fix = "cargo clippy --manifest-path {{workspace_indicator}} --all-features --fix --allow-dirty --allow-staged"
check = "cargo clippy --manifest-path {{workspace_indicator}} --all-features"
fix = "cargo clippy --manifest-path {{workspace_indicator}} --all-features --fix --allow-dirty --allow-staged"
}
["shellcheck"] = (Builtins.shellcheck) {
glob = bash_glob
exclude = bash_exclude
batch = true
check = "shellcheck -x {{ files }}"
}
["shfmt"] = (Builtins.shfmt) {
check_list_files = """
files=$(shfmt -l -s {{ files }})
if [ -n "$files" ]; then
echo "$files"
exit 1
fi
"""
fix = "shfmt -w -s {{ files }}"
glob = bash_glob
exclude = bash_exclude
}

// uses custom pkl linter config
Expand Down
Loading