Skip to content

Commit

Permalink
U: energy cli
Browse files Browse the repository at this point in the history
  • Loading branch information
sxmxta committed Dec 17, 2024
1 parent 095ef7a commit 49d06cb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions cmd/internal/env/energy.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ func (m *EnergyConfig) GoCMD() string {
}

func (m *EnergyConfig) NSISCMD() string {
if tools.CommandExists("makensis") {
return "makensis"
}
//if tools.CommandExists("makensis") {
// return "makensis"
//}
nsis := filepath.Join(m.NSIS, "makensis")
if tools.IsExist(nsis) {
return nsis
Expand All @@ -143,12 +143,12 @@ func (m *EnergyConfig) NSISCMD() string {
}

func (m *EnergyConfig) Z7ZCMD() string {
if tools.CommandExists("7z") {
return "7z"
}
if tools.CommandExists("7za") {
return "7za"
}
//if tools.CommandExists("7z") {
// return "7z"
//}
//if tools.CommandExists("7za") {
// return "7za"
//}
z7z := filepath.Join(m.Z7Z, "7z")
if tools.IsExist(z7z) {
return z7z
Expand All @@ -165,9 +165,9 @@ func (m *EnergyConfig) Z7ZCMD() string {
}

func (m *EnergyConfig) UPXCMD() string {
if tools.CommandExists("upx") {
return "upx"
}
//if tools.CommandExists("upx") {
// return "upx"
//}
upx := filepath.Join(m.UPX, "upx")
if tools.IsExist(upx) {
return upx
Expand Down
21 changes: 11 additions & 10 deletions cmd/internal/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func upxInstallPathName(c *command.Config) string {
}

func z7zInstallPathName(c *command.Config) string {
return filepath.Join(c.Install.Path, consts.ENERGY, "7za")
return filepath.Join(c.Install.Path, consts.ENERGY, "7z")
}

func nsisCanInstall() bool {
Expand Down Expand Up @@ -316,8 +316,9 @@ func checkLocalInstallEnv(config *remotecfg.TConfig, cmdConfig *command.Config)
}, "CEF Framework", func() {
cmdConfig.Install.ICEF = true //yes callback
})

// NSIS
if nsisCanInstall() {
// nsis
check(func() (string, bool) {
if nsisCanInstall() {
return "Windows", env.GlobalDevEnvConfig.NSISCMD() != ""
Expand All @@ -328,16 +329,11 @@ func checkLocalInstallEnv(config *remotecfg.TConfig, cmdConfig *command.Config)
cmdConfig.Install.INSIS = true //yes callback
})
}

// upx
if upxCanInstall() {
// upx
check(func() (string, bool) {
if upxCanInstall() {
if consts.IsDarwin {
if tools.CommandExists("upx") {
return "All", true
}
return "Install: brew install upx", true
}
return "All", env.GlobalDevEnvConfig.UPXCMD() != ""
} else {
return "Unsupported platform UPX.", true
Expand All @@ -346,8 +342,9 @@ func checkLocalInstallEnv(config *remotecfg.TConfig, cmdConfig *command.Config)
cmdConfig.Install.IUPX = true //yes callback
})
}

// 7z
if z7zCanInstall() {
// 7za
check(func() (string, bool) {
if z7zCanInstall() {
return "Windows", env.GlobalDevEnvConfig.Z7ZCMD() != ""
Expand All @@ -358,11 +355,15 @@ func checkLocalInstallEnv(config *remotecfg.TConfig, cmdConfig *command.Config)
cmdConfig.Install.I7za = true //yes callback
})
}

// linux
if consts.IsLinux {
// gtk2
// gtk3
// dpkg
}

// macos
if consts.IsDarwin {
//
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/internal/install/install_nsis.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ func installNSIS(config *remotecfg.TConfig, cmdConfig *command.Config) (string,
}
}
if err == nil {
// 安装目录
// 释放文件
//zip
// 安装目录 释放文件
// zip
if err = tools.ExtractUnZip(savePath, installPath, true); err != nil {
term.Logger.Error(err.Error())
return "", nil
Expand Down

0 comments on commit 49d06cb

Please sign in to comment.