CLI Flags: -v, -V, and --v
I’ve been studying CLI tools and keep seeing different flag styles. Here’s what I’ve learned about conventions and differences.
Command structure
First, a common command structure:

A few more points:
有些命令针对option参数是有长短两种格式的,碰巧图中的b没有对应长格式,但比如f就有
-f和--force。长短参数作用一致,仅仅是书写上的不同Short flags can often be combined, but not always. For example,
git checkout -b newBranch -fcannot be combined intogit checkout -bf newBranch.Flags are case‑sensitive; some commands use uppercase flags.
Flags may take values using a space or
=depending on the CLI. Docker supports both:--name="doc-searcher"equals--name "doc-searcher".
-v, -V, –v
With the structure in mind:
-vis a short flag.--vis a long flag (though uncommon — most tools use names like--version).-Vis a short flag using uppercase.
Recommendations
Different tools vary, which adds learning cost. When building your own CLI, follow common conventions. See commander.js for a well‑adopted model.
- 参数值采用空格方式
- 参数采用长短格式,短格式为单个字符,长格式为完整词汇
- 子命令/参数采用小写
Final Thoughts
- Following CLI conventions improves efficiency and avoids mistakes.
- Good CLI design lowers the learning curve.

