From 60a6e7952bdc5f71639933c3521635b3cb7a0fd4 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Thu, 13 Oct 2022 17:11:02 +0200 Subject: [PATCH] feat new method to get the output of the flags --- api.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api.go b/api.go index 4b4cc8d..145e092 100644 --- a/api.go +++ b/api.go @@ -24,10 +24,16 @@ func Execute[C any](cmd C) *Settings[C] { return execute(cmd, noShadow{}, os.Args[0], os.Args[1:]) } +// PrintFlagOutput prints the flag output to the standard output. func (s *Settings[C]) PrintFlagOutput() { fmt.Println(s.command.flagSet.Output()) } +// GetFlagOutput returns the flag output. +func (s *Settings[C]) GetFlagOutput() { + fmt.Println(s.command.flagSet.Output()) +} + // execute is the internal implementation of ExecuteWithShadow. func execute[C any, D any](cmd C, cnf D, name string, args []string) *Settings[C] { instance := New(name, cmd) -- GitLab