diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 17:02:30 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 17:02:42 +1200 |
commit | 5006146b111b01f4f2ed8ada273349de90ce54c0 (patch) | |
tree | aabc36000af19176c51a78ddb9ce3af380d2fc33 | |
parent | Mention isgr(1) in fgscr(1) and gscr(1) man pages (diff) | |
download | dotfiles-5006146b111b01f4f2ed8ada273349de90ce54c0.tar.gz dotfiles-5006146b111b01f4f2ed8ada273349de90ce54c0.zip |
Add grc(1)
-rw-r--r-- | README.markdown | 2 | ||||
-rwxr-xr-x | bin/grc | 10 | ||||
-rw-r--r-- | man/man1/grc.1 | 17 |
3 files changed, 29 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 2cdafdb3..3c744728 100644 --- a/README.markdown +++ b/README.markdown @@ -323,6 +323,8 @@ Installed by the `install-bin` target: * `gms(1)` runs a set of `getmailrc` files; does much the same thing as the script `getmails` in the `getmail` suite, but runs the requests in parallel and does up to three silent retries using `try(1)` +* `grc(1)` quietly tests whether the given directory appears to be a Git + repository with pending changes * `gscr(1)` scrubs Git repositories. * `han(1)` provides a `keywordprg` for Vim's Bash script filetype that will look for `help` topics. You could use it from the shell too. diff --git a/bin/grc b/bin/grc new file mode 100755 index 00000000..9a02d9da --- /dev/null +++ b/bin/grc @@ -0,0 +1,10 @@ +#!/bin/sh +# Argument or current dir is a Git repository with uncommitted changes +cd -- "${1:-.}" || exit +if ! isgr ; then + printf >&2 'grc: Not a Git repository\n' + exit 1 +fi +isgr || exit +[ -n "$(git ls-files --others --exclude-standard)" ] || +! git diff-index --quiet HEAD diff --git a/man/man1/grc.1 b/man/man1/grc.1 new file mode 100644 index 00000000..dffe75e6 --- /dev/null +++ b/man/man1/grc.1 @@ -0,0 +1,17 @@ +.TH GRC 1 "June 2016" "Manual page for grc" +.SH NAME +.B grc +\- return whether dir is a Git repository with pending changes +.SH SYNOPSIS +.B grc +.br +.B grc +/path/to/repo +.SH DESCRIPTION +.B grc +checks whether the given directory (defaulting to the working directory) is a +Git repository and has pending changes. Normally this emits no output. +.SH SEE ALSO +git(1), isgr(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |