Skip to content

Instantly share code, notes, and snippets.

@zzamboni
Last active June 5, 2018 21:00
Show Gist options
  • Save zzamboni/aeae21ff0de48a37c9158efac0745594 to your computer and use it in GitHub Desktop.
Save zzamboni/aeae21ff0de48a37c9158efac0745594 to your computer and use it in GitHub Desktop.
Example of automatic detection in Elvish of options, their arguments (e.g. <style>, <branch>) and their descriptions using comp:extract-opts
> git checkout -<tab>
COMPLETING argument
--conflict <style> (conflict style (merge or diff3)) --theirs (checkout their version for unmerged files)
--detach (detach HEAD at named commit) --track (set upstream info for new branch)
--force (force checkout (throw away local modifications)) -2 (checkout our version for unmerged files)
--ignore-other-worktrees (do not check if another worktree is holding the given ref) -3 (checkout their version for unmerged files)
--ignore-skip-worktree-bits (do not limit pathspecs to sparse entries only) -B <branch> (create/reset and checkout a branch)
--merge (perform a 3-way merge with the new branch) -b <branch> (create and checkout a new branch)
--orphan <new-branch> (new unparented branch) -f (force checkout (throw away local modions))
--ours (checkout our version for unmerged files) -l (create reflog for new branch)
--overwrite-ignore (update ignored files (default)) -m (perform a 3-way merge with the new branch)
--patch (select hunks interactively) -p (select hunks interactively)
--progress (force progress reporting) -q (suppress progress reporting)
--quiet (suppress progress reporting) -t (set upstream info for new branch)
--recurse-submodules <checkout> (control recursive updating of submodules)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment