PENDING TITLE
DRAFT
A few days ago, I saw a post on Hachyderm asking about the flags --yes, --confirm and --force in CLI
application design. I answered that post with what my brain was able to think at the time, but I thought it was an
interesting topic, so in this post I'm going to try and present my reasoning in a longer form.
The flags
On a surface-level analysis, the three of flags (--yes, --confirm and --force) seem to perform the same function:
To instruct the command to continue when it would otherwise stop. OF course, we can't say anything definitive without
talking about how they're actually used, but the name of the flags already gives some of the differences away.
In my answer to the original post I summarized what my gut tells me based on experience that these flags are intended to communicate, which is more or less the following:
- The
--yesflag is typically used to skip yes/no confirmation questions in interactive commands as if you answered with a yes. - The
--confirmflag is not seen much, and used in commands that can be costly or destructive to confirm that you do want to perform the operation. These kinds of commands ask you would print a summary of the actions they will take, and only proceed if the flag is present, confirming you know what it will do and are ok with it. - The
--forceflag normally reserved for situations in which a command normally refuses to take action because continuing could lead to destructive action or some otherwise unpredictable situation. Using the flag signals to the command that you take responsibility for such destructive action and wish to continue anyway.
The question, then, is more about command line design that just the name of the flag.