diff options
| author | Matt Hunter <m@lfurio.us> | 2026-05-25 22:42:02 -0400 |
|---|---|---|
| committer | Matt Hunter <m@lfurio.us> | 2026-05-31 22:28:36 -0400 |
| commit | 2a1fa5ff11b9b3137a402ede0cd47a2754c9facf (patch) | |
| tree | b03f72df16d50c4ac381fae272a6bc2c9a519f05 | |
| parent | 09a1d8991ce770a55aad05f2c4131a917ded1cb6 (diff) | |
| download | git-sonar-2a1fa5ff11b9b3137a402ede0cd47a2754c9facf.tar.gz git-sonar-2a1fa5ff11b9b3137a402ede0cd47a2754c9facf.zip | |
precheck: Add documentation in new manpage
Adds git-precheck(1) as the primary documentation for git-precheck.
Like with git-sonar, the previous 'git-precheck --help' text is
incorporated, and specifying --help now causes the new manpage to open.
Signed-off-by: Matt Hunter <m@lfurio.us>
| -rw-r--r-- | Makefile | 2 | ||||
| -rwxr-xr-x | git-precheck | 35 | ||||
| -rw-r--r-- | git-precheck.1 | 67 |
3 files changed, 71 insertions, 33 deletions
@@ -1,5 +1,5 @@ SOURCE=git-sonar git-precheck -MANPAGES=git-sonar.1 +MANPAGES=git-sonar.1 git-precheck.1 PREFIX?=/usr/local PWD=$(shell pwd) diff --git a/git-precheck b/git-precheck index fa42eb3..52f1781 100755 --- a/git-precheck +++ b/git-precheck @@ -1,35 +1,6 @@ #!/bin/sh -usage() { - echo "git-precheck [--quiet] [--ignore-dirty] [--ignore-untracked]" - echo "" - echo "If the current working directory is inside a git repository, examine" - echo "the repo for any abnormal state and return an exit code indicating" - echo "the status. If unclean, print a line of text describing each" - echo "condition found." - echo "" - echo " --quiet" - echo " Don't actually print anything." - echo "" - echo " --ignore-dirty" - echo " Don't consider the presence of uncommitted changes to tracked" - echo " files as an abnormal state." - echo "" - echo " --ignore-untracked" - echo " Don't consider the presence of untracked files as an abnormal" - echo " state." - echo "" - echo " Exit codes:" - echo " 0 If inside a repository and all checks return normal" - echo " 1 If untracked files detected" - echo " 2 If dirty/modified files detected" - echo " 3 If any ongoing git operation is in progress" - echo " 4 If not inside a git repository" - echo "" - echo " Exit any other value on error or if 'precheck' operation is" - echo " not completed, such as when viewing this help text." - exit 128 -} +docs() { exec man 1 git-precheck; } quiet="" opt_dirty="true" @@ -40,8 +11,8 @@ while true; do --quiet) quiet="true" ;; --ignore-dirty) opt_dirty="" ;; --ignore-untracked) opt_untracked="" ;; - --help) usage ;; - -h) usage ;; + --help) docs ;; + -h) docs ;; *) break esac shift diff --git a/git-precheck.1 b/git-precheck.1 new file mode 100644 index 0000000..e0861b2 --- /dev/null +++ b/git-precheck.1 @@ -0,0 +1,67 @@ +.TH GIT\-PRECHECK 1 git\-sonar + +.SH NAME +git\-precheck \- detect "unready" state of a git repository + +.SH SYNOPSIS +.B git\-precheck +.RB [ \-\-quiet ] +.RB [ \-\-ignore\-dirty ] +.RB [ \-\-ignore\-untracked ] + +.SH DESCRIPTION +If +.B git\-precheck +is run inside a git repository, it examines the repo for any in\-progress git +operations or unclean state and returns an exit code indicating the status. +Otherwise, +.B git\-precheck +reports that it is not in any git worktree. +.P +If +.B \-\-quiet +is not given, a line of text is printed describing each condition found. + +.SH OPTIONS +.TP +.B \-\-quiet +Don't actually print anything. +.TP +.B \-\-ignore\-dirty +Don't consider the presence of uncommitted changes to tracked files as an +unclean state. +.TP +.B \-\-ignore\-untracked +Don't consider the presence of untracked files as an unclean state. + +.SH EXIT STATUS +.TP +.B 0 +If inside a repository and all checks return normal +.TP +.B 1 +If untracked files are detected +.TP +.B 2 +If dirty/modified files are detected +.TP +.B 3 +If any ongoing git operation is in progress +.TP +.B 4 +If not inside a git repository +.P +.B git\-precheck +will exit with any other value if an error occurs. + +.SH SEE ALSO +.BR git\-sonar (1), +.BR git\-status (1) + +.SH LICENSE +.B git\-precheck +is part of the +.B git\-sonar +project, made available under the terms of the +.B MIT +license. |
