[lxc-devel] [lxd/master] lxc: Just show help on missing subcommand

stgraber on Github lxc-bot at linuxcontainers.org
Fri Aug 16 21:19:52 UTC 2019


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/20190816/b79b5879/attachment.bin>
-------------- next part --------------
From 68b3ad18be0737e59e5dffc42dcaa4d603a56b2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 16 Aug 2019 17:19:36 -0400
Subject: [PATCH] lxc: Just show help on missing subcommand
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/main.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxc/main.go b/lxc/main.go
index b42387f8d3..afd68a23eb 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -247,6 +247,10 @@ To easily setup a local LXD server in a virtual machine, consider using: https:/
 			os.Exit(1)
 		}
 
+		if err == cobra.ErrSubCommandRequired {
+			os.Exit(0)
+		}
+
 		// Default error handling
 		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
 		os.Exit(1)


More information about the lxc-devel mailing list