Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6372719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:16:23+00:00 2026-05-25T01:16:23+00:00

We try to follow standards as best we can for processing arguments and switches

  • 0

We try to follow “standards” as best we can for processing arguments and switches from the command line. For example, by default, we embrace Posix2 and GNU standards for command line parsing.

However, since our utilities are cross-platform, and we want them to be accessible from cross-platform scripts, we also try to be “robust”. So, we implicitly permit both forms:

  myutil --longname

  myutil /longname

This is not perfect in all cases, as it can be somewhat ambiguous, such as Posix support for collapsing “short” switch names (these are the same):

  myutil -abcd
  myutil -a -b -c -d
  myutil /a /b /c /d

(…we do not support collapsing “short names” on Win platforms because that is ambiguous.)

Another cross-platform switch issue that seems a little strange is the “explicit off” switch, where a trailing “-” explicitly identifies a switch as being “turned off”:

  myutil -a-
  myutil --longname-
  myutil /a-
  myutil /longname-

This is unambiguous, so we decided it acceptable. (The “explicit off” of “/a/” and “/longname/” looked really strange, so we went with the trailing “-” as a “cross-platform internal standard”.)

Recall that this historical “explicit off” for switches was sometimes useful to explicitly “turn off” a value that defaulted to “on”, or to remove a switch that may previously have been added to a command-line-being-assembled (such as when assembling a command line from a script where a later decision is made to “remove” a previously added switch).

HOWEVER, upon review: Can this “explicit off” switch be considered harmful (bad form)?

For example, if a utility defaults to “-v” (--verbose) as “on”, we could have a “negative switch” to turn it off:

  myutil -v-

…or, we could merely define a “-q” (--quiet) as a “positive switch” that implicitly turns “on” a “quiet” option (which implies an “off” for the “-v” switch):

  myutil -q

Of course, for any given utility, it would then be redundant to support both the “-v-” and “-q” forms, since they would do the same thing. (In this example, another option would be multiple “verbose levels” with one level being “quiet”, but the goal is to illustrate the “on/off” nature of explicitly disabling a switch.)

After an exhaustive web search that wasted far too much time, it seems the switch “explicit off” has largely fallen out of favor these days (for example, it is not even mentioned in the (Gnu) “Standards for Command Line Interfaces”.)

QUESTION: Should the historic “explicit off” for switches be considered harmful?

Rather than support a “negative switch”, should new command line utilities instead favor a “positive switch” or command-line-option-to-include-levels as “good form”?) If so, is there even a reason to support “explicit off” switches anymore (for new utilities authored today)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:16:24+00:00Added an answer on May 25, 2026 at 1:16 am

    I’ve never heard of a trailing - for turning off a switch. In UNIX-land, it’s using preceding it with no- as in --no-verbose turns off --verbose. At the very least, Ruby’s OptionParser supports this directly; not sure about others.

    As to this pattern “being harmful”: absolutely not. It’s always good to have a fluent comment-line interface. Consider a more destructive option like --force that overwrites existing files. Consider further, a scheme where a user can specify her default command-line options for a given command. Now, if she’s configured --force to be on by default; how does turn it off on a case-by-case basis?

    We don’t want her to edit her config file to disable --force, so we provide --no-force to override it.

    Negatable long-form options can also be helpful in other scripts or crontabs to make it very clear what’s going on:

    3 * 1 * * awesome_script.sh --force my_files
    0 * * * * awesome_script.sh --no-force my_files
    

    The poor sysadmin that must maintain this won’t’ have to go hunting for awesome_script.sh‘s documentation (assuming it even exists) to know what’s going on here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to follow the facebook-android tutorial from here: https://developers.facebook.com/docs/mobile/android/build/#sample I am working in
I am having problems using django-tagging . I try to follow the documentation but
I try to follow the loading progress of big XML files (I'm not the
I try to follow http://edn.embarcadero.com/article/28604 for restarting Interbase. Here is some code: program IBRestart;
We try and embed a what string within binary objects so that we can
Follow up question from What is a "rooted reference"? consider this code, for a
So, i'm trying to follow along with this example . I'm trying to translate
I try to follow the tutor below to build my 1st iOS app step
I'm often having code written as follows try: self.title = item.title().content.string except AttributeError, e:
I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.