Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 1f6bdbb

Browse files
committed
optimise
1 parent 97326a8 commit 1f6bdbb

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/download.go renamed to src/get.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ func getFile(url, fpath string) {
4444
downloadFile(url, fpath)
4545
} else {
4646
isContinue := ' '
47-
fmt.Print("File with the same name exists. New file will cover the old file.\nDo you want to continue? [Y/n]")
47+
fmt.Print(
48+
"File with the same name exists. New file will cover the old file.\n" +
49+
"Do you want to continue? [Y/n]")
4850
fmt.Scanf("%c", &isContinue)
4951

5052
switch strings.ToLower(string(isContinue)) {
@@ -77,7 +79,6 @@ func getFile(url, fpath string) {
7779
downloadFile(newURL, fpath)
7880

7981
fmt.Println("Finished.")
80-
os.Exit(0)
8182
}
8283

8384
func parseToGetUrl(url string) string {

src/jsdget.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func (j *JsdFunc) Run(args []string) {
2121
os.Exit(0)
2222
}
2323

24-
func jsdget(url string, fpath string) {
24+
func jsdget(url string, path string) {
2525
if url == "" || url == "--help" || url == "-h" {
2626
fmt.Println(jsdHelpMsg)
2727
} else {
28-
downloadFile(parseToJsdUrl(url), fpath)
28+
downloadFile(parseToJsdUrl(url), path)
2929
}
3030
}
3131

src/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ func replaceNth(s, old, new string, n int) string {
6868
i += len(old)
6969
}
7070
return s
71-
}
71+
}

0 commit comments

Comments
 (0)