pericmd 016: –foo-bar vs –foo_bar

An “rant intermission” before continuing the topic from previous post. As mentioned before, Perinci::CmdLine will provide a command-line option for each argument specified in the args property of Rinci metadata, with the same name. Except with one rule: underscores will be converted to dashes. So argument named ‘foo_bar’ will have ‘–foo-bar’ as option, not ‘–foo_bar’.

This is purely an issue of taste. I personally can’t stand the mixing of dashes and underscores in ‘–foo_bar’. ‘–foo-bar’ is the variant I see much more often in Unix command line tools. Plus, I see ‘–foo_bar’ as “lazy” and more cumbersome to type and to complete (although with set completion-map-case on in your .inputrc it doesn’t matter if you type dash or underscore.

The same thing happens when I see a mixed case option like ‘–Foo’ or ‘–fooBar’. It looks like it is just translated from an argument without much regard for “beauty” or convention.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s