Implements wrapper for search for apps

This commit is contained in:
dump_stack() 2020-01-02 15:37:32 +00:00
parent 04b2cf63ce
commit 6c72b5de00
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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":