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

4
.gitignore vendored
View File

@ -13,4 +13,6 @@
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
.idea
pikman

View File

@ -1,6 +1,6 @@
package alpine
var PackageManager = "apx "
var PackageManager = "apx"
var Commands = map[string]string{
"autoremove": "--apk autoremove",

View File

@ -1,6 +1,6 @@
package arch
var PackageManager = "apx "
var PackageManager = "apx"
var Commands = map[string]string{
"autoremove": "--aur autoremove",

View File

@ -1,6 +1,6 @@
package fedora
var PackageManager = "apx "
var PackageManager = "apx"
var Commands = map[string]string{
"autoremove": "--dnf autoremove",

View File

@ -1,6 +1,6 @@
package flatpak
var PackageManager = "flatpak "
var PackageManager = "flatpak"
var Commands = map[string]string{
"install": "install",

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)
}

View File

@ -1,6 +1,6 @@
package ubuntu
var PackageManager = "sudo -S apt "
var PackageManager = "sudo -S apt"
var Commands = map[string]string{
"autoremove": "autoremove",