snippet放于根目录中

This commit is contained in:
suguo.yao 2021-09-03 22:28:17 +08:00
parent 5f8872cd53
commit fa15f852fd
2 changed files with 3 additions and 8 deletions

View File

@ -5,7 +5,7 @@
#### 组件工具
1. 安装
> go install myschools.me/suguo/snippet/snippet@latest
> go install myschools.me/suguo/snippet@latest
2. 使用
> snippet -dl mysql

View File

@ -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)
}