Re: mailgw argument parsing

Thomas Arendsen Hein <[email protected]> Tue, 22 Nov 2022 13:58:56 +0100
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
* Ralf Schlatterbeck <[email protected]> [20221121 15:45]:
> So to set several properties on e.g. issue and user you would use
> 
> -C issue -S issueprop1=value1 -S issueprop2=value2 -C user -S userprop=uvalue

> So I'd suggest we change this to only a -S (--set-value) option that
> optionally takes a classname before a '.', the above would become:
> 
> -S issue.issueprop1=value1 -S issue.issueprop2=value2 -S user.userprop=uvalue

> What do you think?

Your suggestion looks good, much more intuitive, and since old calls
will show an error, this should not cause silent misbehavior.

And I really like argparse :)

In a personal project I have extended argparse to accept multiple
parameters per option:
https://hg.intevation.de/fun/mwokit/file/tip/mwokit/parameters.py

So you could write multiple -S options or alternatively:

-S issue.issueprop1=value1,issue.issueprop2=value2,user.userprop=uvalue

and additionally use  -S ''  to clear previous entries or defaults.

See https://hg.intevation.de/fun/mwokit/file/tip/mwokit/dropdeck.py
for a usage example.

(it can also read defaults from an ini file, not sure if this is
useful in Roundup though)

Feel free to relicense this code under the Roundup Licensing if you
use code from it.

Regards,

Thomas

-- 
Thomas Arendsen Hein <[email protected]>  |  https://intevation.de
Intevation GmbH, Osnabrueck, DE; Amtsgericht Osnabrueck, HRB 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter

_______________________________________________
Roundup-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQLThkLcNus8r5Nl/DUXeKP86IlDAUCY3zHhwAKCRDUXeKP86Il
DMwqAQCRQKg0GJgZW/XZyZiwCY+R2xRJS7EYXwvo2p8YXXYoNwD/emjiDdRWrye9
OpSSZEqzWQQ5OHkP/UTlbjfryY9r9gY=
=rzr9
-----END PGP SIGNATURE-----