Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unneeded code #59

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions cmd/dumpsummary/main.go

This file was deleted.

58 changes: 49 additions & 9 deletions cmd/dumpvms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,63 @@ import (
"github.com/containers/libhvee/pkg/hypervctl"
)

func main() {
var err error
const (
summary = "summary"
vms = "vms"
)

func getVms() (string, error) {
vmms := hypervctl.VirtualMachineManager{}

vms, err := vmms.GetAll()
if err != nil {
fmt.Printf("Could not retrieve virtual machines : %s\n", err.Error())
os.Exit(1)
return "", fmt.Errorf("Could not retrieve virtual machines : %s\n", err.Error())
}

b, err := json.MarshalIndent(vms, "", "\t")
if err != nil {
return "", err
}
return string(b), nil
}

func dumpSummary() (string, error) {
vmms := hypervctl.VirtualMachineManager{}
summs, err := vmms.GetSummaryInformation(hypervctl.SummaryRequestNearAll)
if err != nil {
fmt.Println("Failed to generate output")
os.Exit(1)
return "", fmt.Errorf("Could not retrieve virtual machine summaries: %v\n", err)
}
b, err := json.MarshalIndent(summs, "", "\t")
if err != nil {
return "", err
}
return string(b), nil
}

func printHelp() {
fmt.Printf("argument must be one of %q or %q", summary, vms)
}

fmt.Println(string(b))
func main() {
var (
err error
result string
)
args := os.Args
if len(args) != 2 {
printHelp()
os.Exit(1)
}
if arg := args[1]; arg != summary && arg != vms {
printHelp()
os.Exit(1)
}
if args[1] == summary {
result, err = dumpSummary()
} else {
result, err = getVms()
}
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(result)
}
34 changes: 0 additions & 34 deletions cmd/dumpvs/main.go

This file was deleted.

79 changes: 0 additions & 79 deletions cmd/keycreate/main.go

This file was deleted.

52 changes: 0 additions & 52 deletions cmd/wmigen/main.go

This file was deleted.

118 changes: 0 additions & 118 deletions pkg/machine/machine.go

This file was deleted.