|
@@ -4,16 +4,43 @@ import (
|
|
|
"app-uploader/huawei"
|
|
|
"app-uploader/utils"
|
|
|
"fmt"
|
|
|
- "os"
|
|
|
+ "path/filepath"
|
|
|
"runtime"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+
|
|
|
+ "github.com/jessevdk/go-flags"
|
|
|
)
|
|
|
|
|
|
+var GAppOption = &AppOption{}
|
|
|
+
|
|
|
+
|
|
|
+type AppOption struct {
|
|
|
+ Unzip string `short:"d" long:"unzip" description:"unzip file"`
|
|
|
+}
|
|
|
+
|
|
|
+func (o *AppOption) Parse() {
|
|
|
+ _, err := flags.NewParser(o, flags.Default|flags.IgnoreUnknown).Parse()
|
|
|
+ fmt.Println(err)
|
|
|
+}
|
|
|
+
|
|
|
func main() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ GAppOption.Parse()
|
|
|
+ if len(GAppOption.Unzip) > 0 {
|
|
|
+ dest := fmt.Sprintf("output/%s", filepath.Base(GAppOption.Unzip))
|
|
|
+ err := utils.Unzip(GAppOption.Unzip, dest, nil)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("unzip err:", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
appConf, err := utils.ReadAppConfig()
|
|
|
if err != nil {
|
|
|
fmt.Println("读取配置文件错误")
|
|
@@ -106,8 +133,4 @@ func main() {
|
|
|
return
|
|
|
}
|
|
|
fmt.Println("上传成功")
|
|
|
-
|
|
|
-
|
|
|
- os.Remove(zipPath)
|
|
|
-
|
|
|
}
|