Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

I'm trying to decide between short and long options, such as:

-h

vs.

--help

Obviously there are packages that deal with this, particularly in shell and perl programming.

Getopts, Getopts::Std, and Getopts::Long

I would prefer to use both, both -h and --help being a call for a help/usage function, but that requires quite a bit more effort.

So my question is, what are the pros and cons of both, while I like the readability of the long notation, it's also nice and cleaner to be able to use just the simple single character flags.

asked 23 Jul '10, 15:37

rfelsburg's gravatar image

rfelsburg ♦
6061618
accept rate: 25%

edited 23 Jul '10, 17:54




I'm a fan of always providing both methods of argument notation, since different users have different needs.

If you have to make a decision, analyzing your future userbase might help you make your decision. If your users are Linux administrators, it is likely that they are happy with the short notation. Other, less technically-savvy, people might be more happy with the long notation of arguments.

Also, the usage of the script itself is of importance. Will users be typing arguments often (short notation is advisable) or will the script be called automatically from another script/program (long notation for better readability and maintainability)?

link

answered 24 Jul '10, 02:07

Jazz's gravatar image

Jazz ♦
7811312
accept rate: 33%

edited 24 Jul '10, 02:22

I think I found a way to do both, it took quite a bit of reading but Getopts::Long in perl allows for the usage of both via a pipe command in the initial setup. I to am a fan of both, but was wondering on different folks views on each.

(24 Jul '10, 17:10) rfelsburg ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×16
×16
×9
×8
×2

Asked: 23 Jul '10, 15:37

Seen: 1,734 times

Last updated: 24 Jul '10, 02:22

powered by OSQA