Skip to content

Commit

Permalink
shfmt.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Nov 14, 2023
1 parent 2414c30 commit ebc1133
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/apps/shfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ impl App for Shfmt {
vec![
Box::new(DownloadPrecompiledBinary {
name: self.name(),
url: format!("https://github.com/mvdan/sh/releases/download/v{version}/shfmt_v{version}_{os}_{cpu}", os = os_text(platform.os), cpu = cpu_text(platform.cpu)),
url: format!("https://github.com/mvdan/sh/releases/download/v{version}/shfmt_v{version}_{os}_{cpu}{ext}", os = os_text(platform.os), cpu = cpu_text(platform.cpu), ext = ext_text(platform.os)),
artifact_type: ArtifactType::Executable,
file_on_disk: yard.app_file_path(self.name(), version, self.executable(platform)),
}),
Box::new(CompileFromGoSource {
import_path: format!("mvdan.cc/sh/v3/cmd/shfmt@{version}"),
import_path: format!("mvdan.cc/sh/v3/cmd/shfmt@v{version}"),
target_folder: yard.app_folder(self.name(), version),
executable_filename: self.executable(platform),
}),
Expand All @@ -59,3 +59,10 @@ fn cpu_text(cpu: Cpu) -> &'static str {
Cpu::Intel64 => "amd64",
}
}

fn ext_text(os: Os) -> &'static str {
match os {
Os::Windows => ".exe",
Os::Linux | Os::MacOS => "",
}
}

0 comments on commit ebc1133

Please sign in to comment.