Skip to content

Commit 8d45fbe

Browse files
authored
Fix the without fetch option does not work (#70)
1 parent a39891e commit 8d45fbe

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cmd/get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ func (o *downloadOption) preRunE(cmd *cobra.Command, args []string) (err error)
105105
return
106106
}
107107
o.name = ins.Name
108-
cmd.Printf("start to download from %s\n", targetURL)
109108
}
110109
o.URL = targetURL
111110

@@ -139,6 +138,7 @@ func (o *downloadOption) runE(cmd *cobra.Command, args []string) (err error) {
139138
return
140139
}
141140

141+
cmd.Printf("start to download from %s\n", o.URL)
142142
if o.Thread <= 1 {
143143
err = pkg.DownloadWithContinue(o.URL, o.Output, o.ContinueAt, -1, 0, o.ShowProgress)
144144
} else {

cmd/install.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cmd
22

33
import (
4-
"fmt"
54
"github.com/linuxsuren/http-downloader/pkg/installer"
65
"github.com/spf13/cobra"
76
"runtime"
@@ -70,7 +69,6 @@ func (o *installOption) runE(cmd *cobra.Command, args []string) (err error) {
7069
Output: o.Output,
7170
CleanPackage: o.CleanPackage,
7271
}
73-
fmt.Println(process)
7472
err = process.Install()
7573
return
7674
}

pkg/installer/check.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (o *Installer) ProviderURLParse(path string, acceptPreRelease bool) (url st
9393
}
9494
}
9595

96-
fmt.Printf("prepare to download %s/%s\n", org, repo)
96+
fmt.Printf("target package is %s/%s\n", org, repo)
9797
} else {
9898
err = fmt.Errorf("only support format xx, xx/xx or xx/xx/xx")
9999
return
@@ -120,11 +120,13 @@ func (o *Installer) ProviderURLParse(path string, acceptPreRelease bool) (url st
120120
}
121121
o.Name = name
122122

123-
// fetch the latest config
124-
fmt.Println("start to fetch the config")
125-
if err = FetchConfig(); err != nil {
126-
err = fmt.Errorf("unable to fetch the latest config, error: %v", err)
127-
return
123+
if o.Fetch {
124+
// fetch the latest config
125+
fmt.Println("start to fetch the config")
126+
if err = FetchConfig(); err != nil {
127+
err = fmt.Errorf("unable to fetch the latest config, error: %v", err)
128+
return
129+
}
128130
}
129131

130132
// try to parse from config

0 commit comments

Comments
 (0)