From 6bd6f0c43c39a637915375766fd40639aeeb5ac6 Mon Sep 17 00:00:00 2001 From: niusmallnan Date: Wed, 24 Jan 2018 17:53:52 +0800 Subject: [PATCH] Fix shutdown -h command (#2234) --- cmd/power/shutdown.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/power/shutdown.go b/cmd/power/shutdown.go index 119e5f5b..65979a1d 100644 --- a/cmd/power/shutdown.go +++ b/cmd/power/shutdown.go @@ -84,7 +84,7 @@ func Shutdown() { }) } else { app.Flags = append(app.Flags, cli.BoolFlag{ - Name: "H, h, halt", + Name: "H, halt", Usage: "halt the machine", Destination: &haltFlag, }) @@ -94,13 +94,22 @@ func Shutdown() { if app.Name == "poweroff" { app.Flags = append(app.Flags, cli.BoolTFlag{ Name: "P, poweroff", - Usage: "halt the machine", + Usage: "poweroff the machine", Destination: &poweroffFlag, }) } else { + // shutdown -h + // Equivalent to --poweroff + if app.Name == "shutdown" { + app.Flags = append(app.Flags, cli.BoolFlag{ + Name: "h", + Usage: "poweroff the machine", + Destination: &poweroffFlag, + }) + } app.Flags = append(app.Flags, cli.BoolFlag{ Name: "P, poweroff", - Usage: "halt the machine", + Usage: "poweroff the machine", Destination: &poweroffFlag, }) }