command-line option
An argument starting with a dash, such as -r or --help, that changes how a command behaves rather than naming what it works on.
In more detail
Short options use one dash and one letter (-m) and can often be combined (-am), while long options use two dashes and a word (--staged). By convention a lone -- ends the options, so anything after it is treated as an argument even if it starts with a dash.
Examples
git log --oneline -- parser.pyprobe -tries 5 -timeout 2s db-1probe --timeout 2s db-1Related terms
- command-line argument — A word given to a command after its name, such as the file names in cp a.txt b.txt.
- getopts — The builtin that parses short command-line options such as -v, -vq and -f value, one option per call, in a while loop.
- --help — An option most programs accept that prints a short usage summary and exits.
- subcommand — The word after a program's name that picks which of its operations to run, such as status in git status.
- command-line interface — A program you control by typing commands as text in a terminal instead of clicking in a window.
- flag package — Go's standard library package for parsing command-line options into typed values with defaults and a generated usage message.
- positional argument — A command-line argument identified by its position rather than by a flag name, such as the host names after the options.
- usage message — The short help text a command prints to standard error when it is run wrongly, showing its syntax and options.
Taught in
- Moving Around: pwd, ls, cd And Paths — Bash Scripting & Command Line Automation
- Making, Copying, Moving And Removing — Bash Scripting & Command Line Automation
- Help, History, Completion And Aliases — Bash Scripting & Command Line Automation
- Finding Lines: grep And Regular Expressions — Bash Scripting & Command Line Automation
- Reshaping Text: cut, sort, uniq, tr, sed, awk — Bash Scripting & Command Line Automation
- Shell Variables, The Environment And export — Bash Scripting & Command Line Automation
- Script Input And Output: read, Heredocs, printf — Bash Scripting & Command Line Automation
- Arguments: Dollar One, Dollar At, shift — Bash Scripting & Command Line Automation
- Option Parsing With getopts — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Debugging: set -x, bash -n And Reading The Error — Bash Scripting & Command Line Automation
- ShellCheck — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- Installing Git, And Telling It Who You Are — Advanced Git Internals & Distributed Workflows
- A Repository Is A Folder With A Memory — Advanced Git Internals & Distributed Workflows
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- The Three Areas: Working Tree, Index, Repository — Advanced Git Internals & Distributed Workflows
- Staging Deliberately: status, add, add --patch — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Conventional Commits — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- A Branch Is A Moving Pointer — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- The Pull Request, And Branch Naming — Advanced Git Internals & Distributed Workflows
- Resolving A Conflict, Line By Line — Advanced Git Internals & Distributed Workflows
- Amend, And The One Hard Rule — Advanced Git Internals & Distributed Workflows
- Tags And Releases — Advanced Git Internals & Distributed Workflows
- What Go Is and Why It Matters — Concurrent Systems Programming with Go
- Installing the Go Toolchain — Concurrent Systems Programming with Go
- Your First Program and go run — Concurrent Systems Programming with Go
- Variables, Typing, and Zero Values — Concurrent Systems Programming with Go
- Arrays, Slices, and Maps — Concurrent Systems Programming with Go
- Parsing Arguments with flag — Concurrent Systems Programming with Go
- Building Static Binaries — Concurrent Systems Programming with Go
- Project Setup and Configuration — Concurrent Systems Programming with Go