From 65f72a7c5f1840836fa08e75c0fed3af3a533df2 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sun, 9 Oct 2022 15:22:46 +0200
Subject: [PATCH] feat new function GetDefaults()

---
 api.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/api.go b/api.go
index 37ea875..7ef0727 100644
--- a/api.go
+++ b/api.go
@@ -43,3 +43,13 @@ func (s *Settings[C]) Output() string {
 func (s *Settings[C]) Args() []string {
 	return s.args
 }
+
+// GetDefaults returns the default values of the settings.
+func (s *Settings[C]) GetDefaults() string {
+	mem := s.flagOutput
+	s.flagOutput.(*bytes.Buffer).Reset()
+	s.command.flagSet.PrintDefaults()
+	r := s.flagOutput.(*bytes.Buffer).String()
+	s.flagOutput = mem
+	return r
+}
-- 
GitLab