mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[windows] wails doctor docker support Better output
This commit is contained in:
@@ -116,7 +116,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
|
||||
if len(dependenciesMissing) == 0 && dependenciesAvailableRequired == 0 {
|
||||
logger.Println("Your system is ready for Wails development!")
|
||||
logger.Println("")
|
||||
}
|
||||
|
||||
if dependenciesAvailableRequired != 0 {
|
||||
|
||||
@@ -40,14 +40,8 @@ func (d DependencyList) InstallAllRequiredCommand() string {
|
||||
|
||||
result := ""
|
||||
for _, dependency := range d {
|
||||
if dependency.PackageName != "" {
|
||||
if !dependency.Installed && !dependency.Optional {
|
||||
if result == "" {
|
||||
result = dependency.InstallCommand
|
||||
} else {
|
||||
result += " " + dependency.PackageName
|
||||
}
|
||||
}
|
||||
if !dependency.Installed && !dependency.Optional {
|
||||
result += " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +53,8 @@ func (d DependencyList) InstallAllOptionalCommand() string {
|
||||
|
||||
result := ""
|
||||
for _, dependency := range d {
|
||||
if dependency.PackageName != "" {
|
||||
if !dependency.Installed && dependency.Optional {
|
||||
if result == "" {
|
||||
result = " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
|
||||
} else {
|
||||
result += " " + dependency.PackageName
|
||||
}
|
||||
}
|
||||
if !dependency.Installed && dependency.Optional {
|
||||
result += " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func checkNPM() *packagemanager.Dependancy {
|
||||
Name: "npm ",
|
||||
PackageName: "N/A",
|
||||
Installed: installed,
|
||||
InstallCommand: "Install from https://nodejs.org/en/download/",
|
||||
InstallCommand: "Available at https://nodejs.org/en/download/",
|
||||
Version: version,
|
||||
Optional: false,
|
||||
External: false,
|
||||
@@ -64,7 +64,42 @@ func checkUPX() *packagemanager.Dependancy {
|
||||
Name: "upx ",
|
||||
PackageName: "N/A",
|
||||
Installed: installed,
|
||||
InstallCommand: "Install from https://upx.github.io/",
|
||||
InstallCommand: "Available at https://upx.github.io/",
|
||||
Version: version,
|
||||
Optional: true,
|
||||
External: false,
|
||||
}
|
||||
}
|
||||
|
||||
func checkDocker() *packagemanager.Dependancy {
|
||||
|
||||
// Check for npm
|
||||
output, err := exec.Command("docker", "version").Output()
|
||||
installed := true
|
||||
version := ""
|
||||
|
||||
// Docker errors if it is not running so check for that
|
||||
if len(output) == 0 && err != nil {
|
||||
installed = false
|
||||
} else {
|
||||
// Version is in a line like: " Version: 20.10.5"
|
||||
versionOutput := strings.Split(string(output), "\n")
|
||||
for _, line := range versionOutput[1:] {
|
||||
splitLine := strings.Split(line, ":")
|
||||
if len(splitLine) > 1 {
|
||||
key := strings.TrimSpace(splitLine[0])
|
||||
if key == "Version" {
|
||||
version = strings.TrimSpace(splitLine[1])
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return &packagemanager.Dependancy{
|
||||
Name: "docker ",
|
||||
PackageName: "N/A",
|
||||
Installed: installed,
|
||||
InstallCommand: "Available at https://www.docker.com/products/docker-desktop",
|
||||
Version: version,
|
||||
Optional: true,
|
||||
External: false,
|
||||
|
||||
@@ -31,7 +31,7 @@ func (i *Info) discover() error {
|
||||
Name: "gcc ",
|
||||
PackageName: "N/A",
|
||||
Installed: installed,
|
||||
InstallCommand: "",
|
||||
InstallCommand: "Available at https://jmeubank.github.io/tdm-gcc/",
|
||||
Version: version,
|
||||
Optional: false,
|
||||
External: false,
|
||||
@@ -39,6 +39,7 @@ func (i *Info) discover() error {
|
||||
i.Dependencies = append(i.Dependencies, gccDependency)
|
||||
i.Dependencies = append(i.Dependencies, checkNPM())
|
||||
i.Dependencies = append(i.Dependencies, checkUPX())
|
||||
i.Dependencies = append(i.Dependencies, checkDocker())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user