From 882c842e9feb38b0be3e952e397b3e598053d4ac Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jun 2013 21:45:16 -0600 Subject: various fixes with pbs-convert-absgit - libremessages defines a cleanup(); define ours after loading it - don't create TMPDIR or set traps until main() - parse -h flag - print usage to stderr instead of stdout for incorrect number of args --- pbs-convert-absgit | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pbs-convert-absgit b/pbs-convert-absgit index 22539d3..9e82330 100755 --- a/pbs-convert-absgit +++ b/pbs-convert-absgit @@ -1,14 +1,12 @@ #!/bin/bash -euE +. libremessages + cmd="${0##*/}" -export TMPDIR="`mktemp -d --tmpdir ${cmd}.XXXXXXXXXX`" cleanup() { msg "$(gettext "Removing temporary files...")" echo rm -rf "$TMPDIR" } -trap cleanup EXIT - -. libremessages abort() { echo # force a fresh line @@ -192,8 +190,12 @@ usage() { } main() { + in_array '-h' "$@" && { usage; return 0; } + [[ $# = 1 ]] || { usage >&2; return 1; } + + export TMPDIR="`mktemp -d --tmpdir ${cmd}.XXXXXXXXXX`" trap abort EXIT - [[ $# = 1 ]] || { usage; return 1; } + local source=$1 local cache="$(pbs-plumb-config get core.cachedir)/${source}.git" -- cgit v1.1-4-g5e80