[lxc-devel] [lxd/master] lxc/action: Show usage on missing target

stgraber on Github lxc-bot at linuxcontainers.org
Fri Jun 26 18:16:29 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200626/daf4df0e/attachment.bin>
-------------- next part --------------
From 7a63face42c056f026305590fd7a2077edf17b41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 26 Jun 2020 14:16:04 -0400
Subject: [PATCH] lxc/action: Show usage on missing target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc/action.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxc/action.go b/lxc/action.go
index bf64465f3d..17b811774e 100644
--- a/lxc/action.go
+++ b/lxc/action.go
@@ -255,6 +255,11 @@ func (c *cmdAction) Run(cmd *cobra.Command, args []string) error {
 		}
 	} else {
 		names = args
+
+		if len(args) == 0 {
+			cmd.Usage()
+			return nil
+		}
 	}
 
 	if c.flagConsole {


More information about the lxc-devel mailing list