The correct way to use a Ints flag
metalmatze opened this issue · comments
Matthias Loibl commented
In the alertmanager-bot I'm writing I am using kingpin to get a slice of ints from a flag like:
a.Flag("telegram.admin", "The ID of the initial Telegram Admin").
Required().
Envar("TELEGRAM_ADMIN").
IntsVar(&config.telegramAdmins)
For some reason it doesn't work to properly declare these multiple integers. Neither by environment variable nor by flag, as raised in metalmatze/alertmanager-bot#28
Examples of trying this are:
- TELEGRAM_ADMIN=**********,************
- TELEGRAM_ADMIN="**********,************"
- TELEGRAM_ADMIN='**********','************'
- TELEGRAM_ADMIN=['**********','************']
I can't figure out the proper way to use these. Are we missing something?
Thank you.
Alec Thomas commented
Multi-value envars are separated by newlines. Multi-value flags should be passed like so: --telegram.admin=2 --telegram.admin=3
.
Matthias Loibl commented
Perfect. Thanks for the elaboration! Works like a charm.