Skip to content

Commit

Permalink
fix: add os opts to shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Nov 16, 2024
1 parent 2c086c8 commit 4b03f00
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ jobs:
unzip -d $env:USERPROFILE dist\mise-v$version-windows-x64.zip
Add-Content $env:GITHUB_PATH "$env:USERPROFILE/mise/bin"
- run: mise install
continue-on-error: ${{matrix.os == 'windows-latest' && true || false}}
continue-on-error: ${{matrix.os == 'windows-latest' }}
- run: mise test-tool --all
continue-on-error: ${{matrix.os == 'windows-latest' && true || false}}
continue-on-error: ${{matrix.os == 'windows-latest' }}
rpm:
runs-on: ubuntu-latest
needs: [build-tarball]
Expand Down
9 changes: 4 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ fn codegen_registry() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("registry.rs");
let mut lines = vec![r#"
#[allow(clippy::type_complexity)]
const _REGISTRY: &[(&str, &[&str], &[&str], Option<(&str, &str)>, &[&str])] = &["#
pub static FULL_REGISTRY: Lazy<BTreeMap<&'static str, RegistryTool>> = Lazy::new(|| ["#
.to_string()];

let registry: toml::Table = fs::read_to_string("registry.toml")
Expand Down Expand Up @@ -80,8 +79,8 @@ const _REGISTRY: &[(&str, &[&str], &[&str], Option<(&str, &str)>, &[&str])] = &[
})
.unwrap_or_default();
lines.push(format!(
r#" ("{short}", &["{fulls}"], &[{aliases}], {test}, &[{os}]),"#,
fulls = fulls.join("\", \""),
r#" ("{short}", RegistryTool{{backends: vec!["{backends}"], aliases: &[{aliases}], test: &{test}, os: &[{os}]}}),"#,
backends = fulls.join("\", \""),
aliases = aliases
.iter()
.map(|a| format!("\"{a}\""))
Expand All @@ -97,7 +96,7 @@ const _REGISTRY: &[(&str, &[&str], &[&str], Option<(&str, &str)>, &[&str])] = &[
.join(", "),
));
}
lines.push(r#"];"#.to_string());
lines.push(r#"].into());"#.to_string());

fs::write(&dest_path, lines.join("\n")).unwrap();
}
Expand Down
1 change: 1 addition & 0 deletions registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ serverless.backends = ["asdf:pdemagny/asdf-serverless"]
setup-envtest.backends = ["asdf:pmalek/mise-setup-envtest"]
shell2http.backends = ["aqua:msoap/shell2http", "asdf:ORCID/asdf-shell2http"]
shellcheck.backends = ["ubi:koalaman/shellcheck", "asdf:luizm/asdf-shellcheck"]
shellcheck.os = ["linux", "macos"]
shellspec.backends = ["aqua:shellspec/shellspec", "asdf:poikilotherm/asdf-shellspec"]
shfmt.backends = ["asdf:luizm/asdf-shfmt"]
shfmt.os = ["linux", "macos"]
Expand Down
5 changes: 5 additions & 0 deletions src/aqua/aqua_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ impl AquaPackage {
let mut ctx = HashMap::default();
ctx.insert("ARCH".to_string(), "arm64".to_string());
strs.insert(self.parse_aqua_str(&self.asset, v, &ctx));
} else if cfg!(windows) {
strs.insert(format!(
"{}.exe",
self.parse_aqua_str(&self.asset, v, &Default::default())
));
}
strs
}
Expand Down
16 changes: 1 addition & 15 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ pub struct RegistryTool {
pub os: &'static [&'static str],
}

pub static FULL_REGISTRY: Lazy<BTreeMap<&str, RegistryTool>> = Lazy::new(|| {
_REGISTRY
.iter()
.map(|(short, backends, aliases, test, os)| {
let tool = RegistryTool {
backends: backends.to_vec(),
aliases,
test,
os,
};
(*short, tool)
})
.collect()
});
// a rust representation of registry.toml
pub static REGISTRY: Lazy<BTreeMap<&str, RegistryTool>> = Lazy::new(|| {
let mut backend_types = BackendType::iter()
Expand Down Expand Up @@ -64,7 +50,7 @@ pub static REGISTRY: Lazy<BTreeMap<&str, RegistryTool>> = Lazy::new(|| {
.collect();
(*short, tr)
})
.filter(|(_, tool)| !tool.backends.is_empty())
.filter(|(_, tr)| !tr.backends.is_empty())
.collect();

let aliased = registry
Expand Down

0 comments on commit 4b03f00

Please sign in to comment.