Skip to content

Commit

Permalink
Add external URL support for hd-home config (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Jan 31, 2021
1 parent 6186ed5 commit cb57b4a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pull-request.yaml
Expand Up @@ -66,3 +66,10 @@ jobs:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Markdown Link Check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
13 changes: 12 additions & 1 deletion cmd/get.go
Expand Up @@ -142,7 +142,17 @@ func (o *downloadOption) providerURLParse(path string) (url string, err error) {
}
}

if cfg.Filename != "" {
if cfg.URL != "" {
// it does not come from GitHub release
tmp, _ := template.New("hd").Parse(cfg.URL)

var buf bytes.Buffer
if err = tmp.Execute(&buf, hdPackage); err == nil {
url = buf.String()
} else {
return
}
} else if cfg.Filename != "" {
tmp, _ := template.New("hd").Parse(cfg.Filename)

var buf bytes.Buffer
Expand Down Expand Up @@ -170,6 +180,7 @@ type hdConfig struct {
Name string
Filename string
Binary string
URL string `yaml:"url"`
Tar string
Replacements map[string]string
}
Expand Down
1 change: 0 additions & 1 deletion cmd/install.go
Expand Up @@ -142,7 +142,6 @@ func (o *installOption) extractFiles(tarFile, targetName string) (err error) {
if _, err = io.Copy(targetFile, tarReader); err != nil {
break
}
fmt.Println("found ", targetName, header)
found = true
_ = targetFile.Close()
}
Expand Down

0 comments on commit cb57b4a

Please sign in to comment.