From: Mike Frysinger Date: Sat, 13 Jan 2024 05:23:44 +0000 (-0500) Subject: vcs-url: add -# support X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a8d764366e7a95b7adb2b672ba1cf3123ecafb31;p=home.git vcs-url: add -# support --- diff --git a/.bin/vcs-url b/.bin/vcs-url index 99c00d9..6612a33 100755 --- a/.bin/vcs-url +++ b/.bin/vcs-url @@ -154,7 +154,7 @@ git_url() { ;; esac - git log -n3 ${1:-HEAD} | sed "s,^commit ,${url}," + git log -n${num} ${1:-HEAD} | sed "s,^commit ,${url}," } svn_url() { @@ -193,6 +193,8 @@ usage() { Usage: $0 [options] [args] Options: + -# Number of commits to show (default: 3) + -n# Number of commits to show -c CVS URL -g GIT URL (default) -s SVN URL @@ -202,9 +204,11 @@ usage() { } main() { - local vcs="auto" + local vcs="auto" num="3" args=() while [[ $# -gt 0 ]] ; do case $1 in + -n[0-9]*) num="${1:2}";; + -[0-9]*) num="${1:1}";; -c) vcs="cvs";; -s) vcs="svn";; -g) vcs="git";; @@ -212,10 +216,11 @@ main() { -h) usage;; --) shift; break;; -*) usage;; - *) break;; + *) args+=( "$1" );; esac shift done + set -- "${args}" if [[ ${vcs} == "auto" ]] ; then if [[ -d CVS ]] ; then