Implement running non-manager commands in config
This commit is contained in:
parent
661242582e
commit
98dcb1532e
8
main.go
8
main.go
@ -142,8 +142,14 @@ func main() {
|
||||
if useRoot {
|
||||
cmdArr = append(cmdArr, rootCommand)
|
||||
}
|
||||
// Create slice with all commands and arguments for the package manager
|
||||
// If command to be run has a prefix of "cmd:"
|
||||
if strings.HasPrefix(similarTo[0], "cmd:") {
|
||||
// Append the command to the slice without the prefix
|
||||
cmdArr = append(cmdArr, strings.TrimPrefix(similarTo[0], "cmd:"))
|
||||
} else {
|
||||
// Otherwise, append all commands and arguments for the package manager to slice
|
||||
cmdArr = append(cmdArr, config.ActiveManager, similarTo[0])
|
||||
}
|
||||
// If greater than 2 arguments, append them to cmdArr
|
||||
if len(args) >= 2 {
|
||||
cmdArr = append(cmdArr, strings.Join(args[1:], " "))
|
||||
|
8
pak.toml
8
pak.toml
@ -14,6 +14,10 @@ rootCommand = "sudo"
|
||||
upgrade = "upgrade"
|
||||
download = "download"
|
||||
clean = "clean"
|
||||
file-refresh = "cmd:apt-file update"
|
||||
file-search = "cmd:apt-file search"
|
||||
add-key = "cmd:apt-key add"
|
||||
add-repo = "cmd:add-apt-repository"
|
||||
[managers.apt.shortcuts]
|
||||
arm = "autoremove"
|
||||
|
||||
@ -39,6 +43,10 @@ rootCommand = "sudo"
|
||||
show = "show"
|
||||
list = "search '~i'"
|
||||
changelog = "changelog"
|
||||
file-refresh = "cmd:apt-file update"
|
||||
file-search = "cmd:apt-file search"
|
||||
add-key = "cmd:apt-key add"
|
||||
add-repo = "cmd:add-apt-repository"
|
||||
|
||||
[managers.brew]
|
||||
useRoot = false
|
||||
|
Loading…
Reference in New Issue
Block a user