{"thread":{"id":"2079","subject":"[PATCH]: Use ARGS, not positional arguments","startedAt":"2005-10-12T05:57:28Z","lastAt":"2005-10-12T05:57:28Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10001","messageId":"1129096648.2427.47.camel@dv","threadId":"2079","inReplyTo":null,"subject":"[PATCH]: Use ARGS, not positional arguments","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-10-12T05:57:28Z","receivedAt":"2005-10-12T05:57:28Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Some scripts need to be fixed to use ARGS properly.\n\nPositional arguments are no longer preserved in cg-Xlib, so they may not\nbe used.  cg-export uses standard option parsing now.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/cg-admin-lsobj b/cg-admin-lsobj\nindex 8899037..bf3413f 100755\n--- a/cg-admin-lsobj\n+++ b/cg-admin-lsobj\n@@ -39,7 +39,7 @@ USAGE=\"cg-admin-lsobj [OBJECT_TYPE]\"\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n-target=$1\n+target=${ARGS[0]}\n \n \n subdir=$_git_objects\ndiff --git a/cg-branch-add b/cg-branch-add\nindex eb20598..c5462cf 100755\n--- a/cg-branch-add\n+++ b/cg-branch-add\n@@ -63,8 +63,8 @@ USAGE=\"cg-branch-add BRANCH_NAME LOCATIO\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n-name=$1\n-location=$2\n+name=${ARGS[0]}\n+location=${ARGS[1]}\n \n ([ \"$name\" ] && [ \"$location\" ]) || usage\n (echo $name | egrep -qv '[^a-zA-Z0-9_.@!:-]') || \\\ndiff --git a/cg-branch-chg b/cg-branch-chg\nindex 6ac8d15..9c98f6b 100755\n--- a/cg-branch-chg\n+++ b/cg-branch-chg\n@@ -9,8 +9,8 @@ USAGE=\"cg-branch-chg BRANCH_NAME NEW_LOC\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n-name=$1\n-location=$2\n+name=${ARGS[0]}\n+location=${ARGS[1]}\n ([ \"$name\" ] && [ \"$location\" ]) || usage\n \n [ -s \"$_git/branches/$name\" ] || die \"branch does not exist\"\ndiff --git a/cg-export b/cg-export\nindex 594e225..ef9e7cc 100755\n--- a/cg-export\n+++ b/cg-export\n@@ -15,17 +15,22 @@ _git_requires_root=1\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n-if [ \"$1\" = \"-r\" ]; then\n-\tshift\n-\t# We do not resolve to tree id since git-tar-tree can utilize some commit\n-\t# information.\n-\tid=\"$(cg-object-id -c \"$1\" 2>/dev/null)\" || id=\"$1\"\n-\tshift\n-else\n+id=\n+while optparse; do\n+\tif optparse -r=; then\n+\t\t# We do not resolve to tree id since git-tar-tree can\n+\t\t# utilize some commit information.\n+\t\tid=\"$(cg-object-id -c \"$OPTARG\" 2>/dev/null)\" || id=\"$OPTARG\"\n+\telse\n+\t\toptfail\n+\tfi\n+done\n+\n+if [ -z \"$id\" ]; then\n \tid=\"$(cg-object-id -c)\"\n fi\n \n-dest=$1\n+dest=${ARGS[0]}\n \n ([ \"$dest\" ] && [ \"$id\" ]) || usage\n \ndiff --git a/cg-patch b/cg-patch\nindex 2aecd1a..153376e 100755\n--- a/cg-patch\n+++ b/cg-patch\n@@ -70,7 +70,7 @@ redzone_border()\n \n \n reverse=\n-if [ \"$1\" = \"-R\" ]; then\n+if [ \"${ARGS[0]}\" = \"-R\" ]; then\n \treverse=1\n \tshift\n fi\ndiff --git a/cg-reset b/cg-reset\nindex dbd69c6..38b7361 100755\n--- a/cg-reset\n+++ b/cg-reset\n@@ -20,7 +20,7 @@ _git_requires_root=1\n . ${COGITO_LIB}cg-Xlib || exit 1\n deprecated_alias cg-reset cg-cancel\n \n-[ \"$1\" ] && die \"this command takes no parameters; use cg-restore to restore individual files\"\n+[ \"${ARGS[0]}\" ] && die \"this command takes no parameters; use cg-restore to restore individual files\"\n \n if ! [ -s $_git/HEAD ]; then\n \trm -f $_git/HEAD\ndiff --git a/cg-seek b/cg-seek\nindex f07b90c..d2aeb0a 100755\n--- a/cg-seek\n+++ b/cg-seek\n@@ -24,7 +24,7 @@ _git_requires_root=1\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n-dstcommit=$1\n+dstcommit=${ARGS[0]}\n \n \n [ -s $_git/blocked ] && grep -vq '^seeked from ' $_git/blocked && die \"action blocked: $(cat $_git/blocked)\"\n\n\n-- \nRegards,\nPavel Roskin\n"}]}