From ebc11338efffbd516e3b1d36380254409b5418cb Mon Sep 17 00:00:00 2001 From: Kevin Goslar Date: Tue, 14 Nov 2023 09:37:57 -0600 Subject: [PATCH] shfmt.rs --- src/apps/shfmt.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/apps/shfmt.rs b/src/apps/shfmt.rs index cfab78c7..66ac62a2 100644 --- a/src/apps/shfmt.rs +++ b/src/apps/shfmt.rs @@ -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), }), @@ -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 => "", + } +}