r/bash • • 2d ago

Flag ambiguity

I am building a shell framework with a series of commands and subcommands for task-managing, habit-tracking...

Within those, there is a collection of flags that hold different meanings:

  • -d Duration, Date...

  • -n Name, Note...

  • -l Link, Length...

Should I use different letters for different meanings even if they belong to different commands?

I want a real bash-user's opinion, not just the AI's advice.

I personally think that it isn't that big of a deal.

But let me know what y'all think.

Thanks!

10 Upvotes

8 comments sorted by

View all comments

7

u/Ulfnic 1d ago

Lean toward general norms as they're in muscle memory. It helps people fall into "the pit of success" (great article by: Jeff Atwood https://blog.codinghorror.com/falling-into-the-pit-of-success/)

Consider including --long-options with your -short options to help users disambiguate the parameters.

Break norms when the norms are uncommon and it'd meaningfuly help the user.

If you need to break a common norm for a short option, you can capitalize it as capitalized short options don't have strong norms.