-
…in reply to @davatron5000
davatron5000 Exactly right. You could modify slightly for your intended case and use argument array indexes so that you can flag like you wanted
--some-flag input.txt. I opted for the=because it forces them into the same argument and I could just do string matching. -
…in reply to @rockerest
davatron5000 Oops sorry, I'm so used to seeing
--I ignored it. It's actually sans-hyphens. If you wanted to "simulate" that, you'd have to handle the hyphens manually, perhaps by just stripping them from the beginning of every argument, or by making the test expressions include the hyphens -
…in reply to @rockerest
davatron5000 That said, there are libraries that would do *all* of this for you. I'm assuming you want something standalone.