mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-26 22:23:01 +00:00
Implements wrapper for search for apps
This commit is contained in:
parent
04b2cf63ce
commit
6c72b5de00
@ -40,6 +40,10 @@ You need to **relogin** if you install virt-manager (libvirt) first time.
|
||||
|
||||
$ go get -u code.dumpstack.io/tools/appvm
|
||||
|
||||
## Search for applications
|
||||
|
||||
$ appvm search chromium
|
||||
|
||||
## Generate new application
|
||||
|
||||
$ nix-channel --list
|
||||
|
18
appvm.go
18
appvm.go
@ -314,6 +314,19 @@ func autoBalloon(l *libvirt.Libvirt, memoryMin, adjustPercent uint64) {
|
||||
table.Render()
|
||||
}
|
||||
|
||||
func search(name string) {
|
||||
command := exec.Command("nix", "search", name)
|
||||
bytes, err := command.Output()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, line := range strings.Split(string(bytes), "\n") {
|
||||
fmt.Println(line)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var configDir = os.Getenv("HOME") + "/.config/appvm/"
|
||||
|
||||
func main() {
|
||||
@ -359,9 +372,14 @@ func main() {
|
||||
generateBin := generateCommand.Arg("bin", "Binary").Default("").String()
|
||||
generateVMName := generateCommand.Flag("vm", "Use VM Name").Default("").String()
|
||||
|
||||
searchCommand := kingpin.Command("search", "Search for application")
|
||||
searchName := searchCommand.Arg("name", "Application name").Required().String()
|
||||
|
||||
switch kingpin.Parse() {
|
||||
case "list":
|
||||
list(l)
|
||||
case "search":
|
||||
search(*searchName)
|
||||
case "generate":
|
||||
generate(l, *generateName, *generateBin, *generateVMName)
|
||||
case "start":
|
||||
|
Loading…
Reference in New Issue
Block a user