snippet放于根目录中
This commit is contained in:
parent
5f8872cd53
commit
fa15f852fd
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#### 组件工具
|
||||
1. 安装
|
||||
> go install myschools.me/suguo/snippet/snippet@latest
|
||||
> go install myschools.me/suguo/snippet@latest
|
||||
2. 使用
|
||||
> snippet -dl mysql
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ func main() {
|
|||
|
||||
// get all file link and download it
|
||||
func dl(client http.Client, path string, wg *sync.WaitGroup) {
|
||||
if !isExist(path) {
|
||||
_, err := os.Stat(path)
|
||||
if !os.IsNotExist(err) {
|
||||
os.MkdirAll(path, 0775)
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +113,3 @@ func getHtml(client http.Client, url string) ([]byte, error) {
|
|||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// if file or directory exits
|
||||
func isExist(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return !os.IsNotExist(err)
|
||||
}
|
||||
Loading…
Reference in New Issue