Skip to content

Commit

Permalink
Revert "Rename up command to start, and down to stop"
Browse files Browse the repository at this point in the history
This reverts commit c764ea1.
  • Loading branch information
bensallen committed Dec 23, 2019
1 parent 2651982 commit b58279a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion internal/stop/stop.go → internal/down/down.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package stop
package down

import (
"fmt"
Expand Down
36 changes: 18 additions & 18 deletions internal/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
"github.com/bensallen/hkmgr/internal/config"
"github.com/bensallen/hkmgr/internal/console"
"github.com/bensallen/hkmgr/internal/destroy"
"github.com/bensallen/hkmgr/internal/down"
"github.com/bensallen/hkmgr/internal/ssh"
start "github.com/bensallen/hkmgr/internal/start"
"github.com/bensallen/hkmgr/internal/status"
stop "github.com/bensallen/hkmgr/internal/stop"
"github.com/bensallen/hkmgr/internal/up"
"github.com/integrii/flaggy"
"github.com/kr/pretty"
)

var version = "unknown"

func Run() error {
var startSubcommand *flaggy.Subcommand
var stopSubcommand *flaggy.Subcommand
var upSubcommand *flaggy.Subcommand
var downSubcommand *flaggy.Subcommand
var destroySubcommand *flaggy.Subcommand
var validateSubcommand *flaggy.Subcommand
var sshSubcommand *flaggy.Subcommand
Expand All @@ -42,15 +42,15 @@ func Run() error {
flaggy.Bool(&debug, "d", "debug", "Enable debug output")
flaggy.Bool(&dryRun, "n", "dry-run", "Don't execute any commands that affect change, just show what will be run")

startSubcommand = flaggy.NewSubcommand("start")
startSubcommand.Description = "Start VMs"
startSubcommand.AddPositionalValue(&vmName, "name", 1, false, "Specify a VM, otherwise all VMs will be run")
upSubcommand = flaggy.NewSubcommand("up")
upSubcommand.Description = "Start VMs"
upSubcommand.AddPositionalValue(&vmName, "name", 1, false, "Specify a VM, otherwise all VMs will be run")

stopSubcommand = flaggy.NewSubcommand("stop")
stopSubcommand.Description = "Stop VMs"
var stopSignal string
stopSubcommand.String(&stopSignal, "s", "signal", "Signal to send to VM")
stopSubcommand.AddPositionalValue(&vmName, "name", 1, false, "Specify a VM, otherwise all VMs will be stopped")
downSubcommand = flaggy.NewSubcommand("down")
downSubcommand.Description = "Stop VMs"
var downSignal string
downSubcommand.String(&downSignal, "s", "signal", "Signal to send to VM")
downSubcommand.AddPositionalValue(&vmName, "name", 1, false, "Specify a VM, otherwise all VMs will be stopped")

destroySubcommand = flaggy.NewSubcommand("destroy")
destroySubcommand.Description = "Destroy VMs"
Expand All @@ -72,8 +72,8 @@ func Run() error {
consoleSubcommand.Description = "Open Console of VM"
consoleSubcommand.AddPositionalValue(&vmName, "name", 1, true, "Specify a VM")

flaggy.AttachSubcommand(startSubcommand, 1)
flaggy.AttachSubcommand(stopSubcommand, 1)
flaggy.AttachSubcommand(upSubcommand, 1)
flaggy.AttachSubcommand(downSubcommand, 1)
//flaggy.AttachSubcommand(destroySubcommand, 1)
//flaggy.AttachSubcommand(validateSubcommand, 1)
flaggy.AttachSubcommand(statusSubcommand, 1)
Expand Down Expand Up @@ -113,12 +113,12 @@ func Run() error {
}

switch {
case startSubcommand.Used:
if err := start.Run(&config, vmName, debug, dryRun); err != nil {
case upSubcommand.Used:
if err := up.Run(&config, vmName, debug, dryRun); err != nil {
return err
}
case stopSubcommand.Used:
if err := stop.Run(&config, vmName, stopSignal); err != nil {
case downSubcommand.Used:
if err := down.Run(&config, vmName, downSignal); err != nil {
return err
}
case destroySubcommand.Used:
Expand Down
2 changes: 1 addition & 1 deletion internal/start/start.go → internal/up/up.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package start
package up

import (
"fmt"
Expand Down

0 comments on commit b58279a

Please sign in to comment.