#1889·cobra

[question] How to pass two values for an option?

Author: chubinCreated Jan 5, 2023Updated Aug 25, 2026

I am writing a drop-in replacement for an existing tool. This tool accepts command line options with two arguments:

--arg name value

Is it possible to configure cobra in such way, that it would expect two values for one argument?

(of course, it is possible to use = as a separator: --arg name=value etc, but as I said, it is not an option in my case, because I am working on a fully compatible drop-in replacement)

/cc stackoverflow: https://stackoverflow.com/questions/75018376/how-to-pass-two-values-for-an-option-in-cobra