refactor: Add getURL()
This commit is contained in:
parent
13ddb0fba5
commit
a488e041c8
4 changed files with 37 additions and 9 deletions
19
lib/get-url.js
Normal file
19
lib/get-url.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function getURL(os, extended, version) {
|
||||
let extendedStr = "";
|
||||
let ext = "tar.gz";
|
||||
|
||||
if (extended === true) {
|
||||
extendedStr = "extended_";
|
||||
}
|
||||
|
||||
if (os === "Windows") {
|
||||
ext = "zip";
|
||||
}
|
||||
|
||||
const hugoName = `hugo_${extendedStr}${version}_${os}-64bit`;
|
||||
const url = `https://github.com/gohugoio/hugo/releases/download/v${version}/${hugoName}.${ext}`;
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = getURL;
|
||||
Loading…
Add table
Add a link
Reference in a new issue