Skip to content

Commit 8f30aac

Browse files
author
Edward Thomson
committed
Add --help information
1 parent cd20e0e commit 8f30aac

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

git-recover

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,41 @@ DO_INTERACTIVE=0
1919
BLOBS=()
2020
FILENAMES=()
2121

22+
function print_usage {
23+
echo "usage: $PROGNAME [-a] [-i] [--full] [<id> [-f <filename>] ...]"
24+
}
25+
26+
function show_help {
27+
print_usage
28+
29+
echo ""
30+
echo "Recover deleted files in your git repository"
31+
echo ""
32+
echo "Options:"
33+
echo " -a, --all Write all orphaned blobs to the current working"
34+
echo " directory. Each file will be named using its 40"
35+
echo " character object ID."
36+
echo " -i, --interactive Display information about each orphaned blob and then"
37+
echo " prompt to recover it."
38+
echo " --full List or recover all orphaned blobs, even those that"
39+
echo " are in packfiles. By default, git-recover will only"
40+
echo " look at loose object files, which limits it to the"
41+
echo " most recently created files. Examining packfiles may"
42+
echo " be slow, especially in large repositories."
43+
echo " <id> The object ID (or its abbreviation) to recover. The"
44+
echo " file will be written to the current working directory"
45+
echo " and named using its 40 character object ID, unless the"
46+
echo " -f option is specified."
47+
echo " -f, --filename name When specified after an object ID, the file written"
48+
echo " will use this filename. In addition, any filters"
49+
echo " (for example: CRLF conversion or Git-LFS) will be run"
50+
echo " according to the gitattributes configuration."
51+
52+
exit 0
53+
}
54+
2255
function die_usage {
23-
echo "usage: $PROGNAME [-a] [-i] [--full] [<id> [-f <filename>] ...]" >&2
56+
print_usage >&2
2457
exit 1
2558
}
2659

@@ -35,6 +68,9 @@ while [[ $# -gt 0 ]]; do
3568
--full)
3669
DO_FULL=1
3770
;;
71+
-h|--help)
72+
show_help
73+
;;
3874
*)
3975
if [ "${1:0:1}" == "-" ]; then
4076
echo "$PROGNAME: unknown argument: $1" >&2

0 commit comments

Comments
 (0)