What do the [], <>, - and -- mean in the help docs? [duplicate]
Asked Answered
J

1

7

What do the [], <>, - and -- mean in the help docs?

When I use git, I can use git help to show the usage of a command, but I am not quite sure I understand the symbols:

$ git help 
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

EDIT

Is there any difference between - and --?

Jessicajessie answered 15/12, 2017 at 9:43 Comment(2)
linux.die.net/man/7/man-pages in particular the SYNOPSIS description.Bounce
Conventionally, single dashes are used before single-character option arguments, while double dashes are used before option names which are spelled out in full. So notice the difference between the synonyms -p with a single dash and --paginate with a double dash.Bounce
H
9

[] means it is optional

-- or - is actually to be written in front of the option. Some options start with a -, some with doubled --, stick with the one that is written for the option you need.

<> stands for some placeholder to be replaced by what you need. (e.g. <path> is supposed to be replaced by actual path of some relevant file for the option)

[A | B] means you can choose between A or B


NB : It is very much like the syntax of many Unix / Linux command line utilities "usage help". You can have a look at https://linux.die.net/man/7/man-pages, thanks @tripleee for the link.


Historically, there are several reasons why there are some options with only one dash -and some with two. Often, the "One-dash" is for an option where you use only one letter. But it is sometimes a bit more complicated than that.

Ha answered 15/12, 2017 at 9:44 Comment(2)
What kind of "syntax" is this?Palpebrate
I think it's supposed to mean "syntactic conventions in manual pages".Bounce

© 2022 - 2024 — McMap. All rights reserved.