Commit d5df2bdc by shenyizhong

* code review

1 parent aa925ec0
Showing with 17 additions and 14 deletions
......@@ -32,7 +32,7 @@ func isValidToken(token string) (bool, error) {
func main() {
fmt.Println("seetadm v0.0.4")
fmt.Println("seetadm v0.0.5")
if len(os.Args) < 6 {
printUsage()
......@@ -58,6 +58,22 @@ func main() {
nodetree.StrDst = os.Args[3]
}
if nodetree.StrOp == "upload" {
nodetree.StrSrc, err = filepath.Abs(nodetree.StrSrc)
if err != nil {
fmt.Println(err)
return
}
nodetree.StrSrc += "/"
} else if nodetree.StrOp == "download" {
nodetree.StrDst, err = filepath.Abs(nodetree.StrDst)
if err != nil {
fmt.Println(err)
return
}
nodetree.StrDst += "/"
}
if nodetree.StrHost == "" {
fmt.Println("parse config error")
return
......@@ -108,12 +124,6 @@ func main() {
if nodetree.StrOp == "upload" {
nodetree.StrDst = "data" + nodetree.StrDst
nodetree.StrSrc, err = filepath.Abs(nodetree.StrSrc)
if err != nil {
fmt.Println(err)
return
}
nodetree.StrSrc += "/"
tmpstr := nodetree.StrSrc[:len(nodetree.StrSrc)-1]
idx := strings.LastIndex(tmpstr, "/")
......@@ -149,13 +159,6 @@ func main() {
//out_loc.WriteTo(os.Stdout)
} else if nodetree.StrOp == "download" {
nodetree.StrDst, err = filepath.Abs(nodetree.StrDst)
if err != nil {
fmt.Println(err)
return
}
nodetree.StrDst += "/"
nodetree.StrSrc = "data" + nodetree.StrSrc
if err != nil {
fmt.Println(err)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!