VOL-2168 - add the ability to specify default formats and ordering

Change-Id: Ie867bbd8d055e34f26eb43466a92f1d1954e35d4
diff --git a/internal/pkg/commands/config.go b/internal/pkg/commands/config.go
index aadc9d2..3ba4118 100644
--- a/internal/pkg/commands/config.go
+++ b/internal/pkg/commands/config.go
@@ -19,7 +19,6 @@
 	"fmt"
 	flags "github.com/jessevdk/go-flags"
 	"gopkg.in/yaml.v2"
-	"log"
 )
 
 const copyrightNotice = `
@@ -39,12 +38,17 @@
 #
 `
 
+type CommandOptionsDump struct{}
+
 type ConfigOptions struct {
+	Commands CommandOptionsDump `command:"commands"`
 }
 
 func RegisterConfigCommands(parent *flags.Parser) {
-	if _, err := parent.AddCommand("config", "generate voltctl configuration", "Commands to generate voltctl configuration", &ConfigOptions{}); err != nil {
-		log.Fatalf("Unexpected error while attempting to register config commands : %s", err)
+	if command, err := parent.AddCommand("config", "generate voltctl configuration", "Commands to generate voltctl configuration", &ConfigOptions{}); err != nil {
+		Error.Fatalf("Unexpected error while attempting to register config commands : %s", err)
+	} else {
+		command.SubcommandsOptional = true
 	}
 }
 
@@ -59,3 +63,14 @@
 	fmt.Println(string(b))
 	return nil
 }
+
+func (commands *CommandOptionsDump) Execute(args []string) error {
+	ProcessGlobalOptions()
+	b, err := yaml.Marshal(GlobalCommandOptions)
+	if err != nil {
+		return err
+	}
+	fmt.Println(copyrightNotice)
+	fmt.Println(string(b))
+	return nil
+}