From a8d764366e7a95b7adb2b672ba1cf3123ecafb31 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 13 Jan 2024 00:23:44 -0500 Subject: [PATCH] vcs-url: add -# support --- .bin/vcs-url | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 -- 2.39.5