Fix incorrect spacing of commands

This commit is contained in:
ferrreo 2023-01-18 17:52:29 +00:00
parent abcc91ecb9
commit bb345ba8a2
7 changed files with 13 additions and 11 deletions

2
.gitignore vendored
View File

@ -14,3 +14,5 @@
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
pikman

10
main.go
View File

@ -247,35 +247,35 @@ func getCommand(command string, osType OSType, containerName string, packageName
case Arch:
cmd, ok := arch.Commands[command]
if ok {
return arch.PackageManager + cmd + containerName + strings.Join(packageName, " "), nil
return fmt.Sprintf("%s %s %s %s", arch.PackageManager, cmd, containerName, strings.Join(packageName, " ")), nil
} else {
return "", fmt.Errorf("%s: is not a valid command for Arch", command)
}
case Fedora:
cmd, ok := fedora.Commands[command]
if ok {
return fedora.PackageManager + cmd + containerName + strings.Join(packageName, " "), nil
return fmt.Sprintf("%s %s %s %s", fedora.PackageManager, cmd, containerName, strings.Join(packageName, " ")), nil
} else {
return "", fmt.Errorf("%s: is not a valid command for Fedora", command)
}
case Flatpak:
cmd, ok := flatpak.Commands[command]
if ok {
return flatpak.PackageManager + cmd + strings.Join(packageName, " "), nil
return fmt.Sprintf("%s %s %s", flatpak.PackageManager, cmd, strings.Join(packageName, " ")), nil
} else {
return "", fmt.Errorf("%s: is not a valid command for Flatpak", command)
}
case Alpine:
cmd, ok := alpine.Commands[command]
if ok {
return alpine.PackageManager + cmd + containerName + strings.Join(packageName, " "), nil
return fmt.Sprintf("%s %s %s %s", alpine.PackageManager, cmd, containerName, strings.Join(packageName, " ")), nil
} else {
return "", fmt.Errorf("%s: is not a valid command for Alpine", command)
}
case Ubuntu:
cmd, ok := ubuntu.Commands[command]
if ok {
return ubuntu.PackageManager + cmd + strings.Join(packageName, " "), nil
return fmt.Sprintf("%s %s %s", ubuntu.PackageManager, cmd, strings.Join(packageName, " ")), nil
} else {
return "", fmt.Errorf("%s: is not a valid command for Ubuntu", command)
}