Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verbose option #213

Open
suntong opened this issue Feb 10, 2023 · 2 comments
Open

Verbose option #213

suntong opened this issue Feb 10, 2023 · 2 comments

Comments

@suntong
Copy link

suntong commented Feb 10, 2023

Can go-arg provide the accumulative option like what ssh or rsync does for verbose in future please?

I.e., the more -v are specified on the command line, the more verbose it will be. This will be good for other purpose like debug as well. From the manual page of rsync(1):

   --verbose, -v            increase verbosity

          This option increases the amount of information  you  are  given
          during  the transfer.  By default, rsync works silently.  A sin-
          gle -v will give you information  about  what  files  are  being
          transferred and a brief summary at the end.  Two -v options will
          give you  information  on  what  files  are  being  skipped  and
          slightly  more information at the end.  More than two -v options
          should only be used if you are debugging rsync.
@alexflint
Copy link
Owner

There is no way to do this at present. I'm open to implementing it.

@suntong
Copy link
Author

suntong commented Feb 10, 2023

Here is how I did it with the go-flags package that supports function callbacks:

https://github.com/go-easygen/go-flags-demo/blob/9bd93b8afac3a2ad36bbb96e7e0e9a7230ea8756/go-flags-demo_main.go#L47-L49

	opts.Verbflg = func() {
		opts.Verbose++
	}

Just for reference, I'm sure you'll find a better way, :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants