From 4e56ee205ae5776e94a6f1cae6bcdc0901b7cd58 Mon Sep 17 00:00:00 2001 From: Russell Bunch Date: Sat, 8 Jun 2024 09:48:15 -0500 Subject: [PATCH] Fixes 60 - `off` and `cycle` `power off` and `power cycle` had `Args: cobra.MinimumNArgs(1)` set. This was previously removed for several other commands because it broke piping. When piping occurs, at least with how `gru` accepts piped arguments, the `args[]` slice is empty. In order for piping to work, we can not set a minimum number of arguments. There may be another way to handle piping, assuming there's a way to get in front of Cobra. --- pkg/cmd/cli/chassis/power/cycle.go | 1 - pkg/cmd/cli/chassis/power/off.go | 1 - 2 files changed, 2 deletions(-) diff --git a/pkg/cmd/cli/chassis/power/cycle.go b/pkg/cmd/cli/chassis/power/cycle.go index 2882093..43b1162 100644 --- a/pkg/cmd/cli/chassis/power/cycle.go +++ b/pkg/cmd/cli/chassis/power/cycle.go @@ -43,7 +43,6 @@ func NewPowerCycleCommand() *cobra.Command { Short: "Power cycle the target machine(s)", Long: `Performs an ACPI shutdown and startup to power cycle the target machine(s). Also allows bypassing the OS shutdown, forcing a warm boot.`, - Args: cobra.MinimumNArgs(1), Run: func(c *cobra.Command, args []string) { var resetType redfish.ResetType diff --git a/pkg/cmd/cli/chassis/power/off.go b/pkg/cmd/cli/chassis/power/off.go index b07c739..fa6161f 100644 --- a/pkg/cmd/cli/chassis/power/off.go +++ b/pkg/cmd/cli/chassis/power/off.go @@ -44,7 +44,6 @@ func NewPowerOffCommand() *cobra.Command { Long: `Powers off the target machine(s) with an ACPI shutdown. Permits forcing a shutdown (without waiting for the OS), as well as a power-button emulated shutdown.`, - Args: cobra.MinimumNArgs(1), Run: func(c *cobra.Command, args []string) { var resetType redfish.ResetType