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 {
|
if useRoot {
|
||||||
cmdArr = append(cmdArr, rootCommand)
|
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])
|
cmdArr = append(cmdArr, config.ActiveManager, similarTo[0])
|
||||||
|
}
|
||||||
// If greater than 2 arguments, append them to cmdArr
|
// If greater than 2 arguments, append them to cmdArr
|
||||||
if len(args) >= 2 {
|
if len(args) >= 2 {
|
||||||
cmdArr = append(cmdArr, strings.Join(args[1:], " "))
|
cmdArr = append(cmdArr, strings.Join(args[1:], " "))
|
||||||
|
8
pak.toml
8
pak.toml
@ -14,6 +14,10 @@ rootCommand = "sudo"
|
|||||||
upgrade = "upgrade"
|
upgrade = "upgrade"
|
||||||
download = "download"
|
download = "download"
|
||||||
clean = "clean"
|
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]
|
[managers.apt.shortcuts]
|
||||||
arm = "autoremove"
|
arm = "autoremove"
|
||||||
|
|
||||||
@ -39,6 +43,10 @@ rootCommand = "sudo"
|
|||||||
show = "show"
|
show = "show"
|
||||||
list = "search '~i'"
|
list = "search '~i'"
|
||||||
changelog = "changelog"
|
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]
|
[managers.brew]
|
||||||
useRoot = false
|
useRoot = false
|
||||||
|
Loading…
Reference in New Issue
Block a user