~craftyguy/superd

a1ecad6df02296dcb32c4051c2815745ca7590dd — Clayton Craft 1 year, 1 month ago 75cd01e
superctl: simplify logic for status cmd

Increases line count slightly, but imho this is much more readable than before
1 files changed, 8 insertions(+), 7 deletions(-)

M cmd/superctl/main.go
M cmd/superctl/main.go => cmd/superctl/main.go +8 -7
@@ 149,18 149,19 @@ func main() {
			fatalError(resp.ErrorMsg)
		}

		if len(resp.Result) == 0 {
		switch len(resp.Result) {
		case 0:
			logger.Fatal("no statuses were returned by superd")
		} else if len(services) == 0 || len(resp.Result) > 1 {
			// print less detailed status for many services
			if err := printStatusMulti(resp.Result); err != nil {
				logger.Fatal(err)
			}
		} else {
		case 1:
			// print detailed output for 1 service
			if err := printStatusSingle(services[0], resp.Result[services[0]]); err != nil {
				logger.Fatal(err)
			}
		default:
			// print less detailed status for many services
			if err := printStatusMulti(resp.Result); err != nil {
				logger.Fatal(err)
			}
		}

	} else if enableCmd.Used {