Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add external URL support for hd-home config #13

Merged
merged 1 commit into from Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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