Commit 3babbce3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

gitask: extract task viewing into do_task_list/do_task_show/do_task_log functions

parent 8b124e01
...@@ -105,6 +105,57 @@ get_last_from() ...@@ -105,6 +105,57 @@ get_last_from()
echo "$FROMSTR" echo "$FROMSTR"
} }
do_task_list()
{
if [ "$1" = "--all" ] || [ "$1" = "-a" ] ; then
shift
docmd ssh $GEARHOST task ls --user=ALL --state=ALL "$@"
return
fi
# TODO: support --user=
if [ "$1" = "--user" ] || [ "$1" = "-u" ] ; then
local U="$2"
shift 2
docmd ssh $GEARHOST task ls --user=$U "$@"
return
fi
if [ "$1" = "-w" ] ; then
local WN="$2"
[ -z "$WN" ] && WN=10
watch -c -n $WN $0 ls
return
fi
# TODO: with arg(s) — subtask
# TODO: add support ls -a (with subtasks)
if [ -n "$1" ] || ! isatty ; then
showcmd "$GEARHOST>" girar-show "$@"
GIT_ALT=$GEARHOST girar-show "$@" | stripcolors
else
showcmd "$GEARHOST>" 'girar-show | head -n20'
GIT_ALT=$GEARHOST girar-show | head -n20
echo "(end of head -n20 output)"
fi
}
do_task_show()
{
local TASK="$1"
local VERBOSE="$2"
if [ -n "$VERBOSE" ] ; then
docmd ssh $GEARHOST task show "$TASK"
else
showcmd "$GEARHOST>" girar-show "${TASK}@"
GIT_ALT=$GEARHOST girar-show "${TASK}@"
fi
}
do_task_log()
{
local TASK="$1"
showcmd "$GEARHOST>" girar-show "$TASK"
GIT_ALT=$GEARHOST girar-show "$TASK"
}
NEXTCOMMAND='' NEXTCOMMAND=''
$EPMCMD assure girar-show girar-utils $EPMCMD assure girar-show girar-utils
...@@ -193,8 +244,7 @@ if [ "$1" = "log" ] ; then ...@@ -193,8 +244,7 @@ if [ "$1" = "log" ] ; then
shift shift
TASK="$(get_task_number $1)" TASK="$(get_task_number $1)"
[ -n "$TASK" ] || TASK="$(get_last)" || fatal [ -n "$TASK" ] || TASK="$(get_last)" || fatal
showcmd "$GEARHOST>" girar-show "$TASK" do_task_log "$TASK"
GIT_ALT=$GEARHOST girar-show "$TASK"
exit exit
fi fi
...@@ -228,34 +278,7 @@ fi ...@@ -228,34 +278,7 @@ fi
if [ "$1" = "ls" ] ; then if [ "$1" = "ls" ] ; then
shift shift
if [ "$1" = "--all" ] || [ "$1" = "-a" ] ; then do_task_list "$@"
shift
docmd ssh $GEARHOST task ls --user=ALL --state=ALL "$@"
exit
fi
# TODO: support --user=
if [ "$1" = "--user" ] || [ "$1" = "-u" ] ; then
U="$2"
shift 2
docmd ssh $GEARHOST task ls --user=$U "$@"
exit
fi
if [ "$1" = "-w" ] ; then
WN="$2"
[ -z "$WN" ] && WN=10
watch -c -n $WN $0 ls
exit
fi
# TODO: with arg(s) — subtask
# TODO: add support ls -a (with subtasks)
if [ -n "$1" ] || ! isatty ; then
showcmd "$GEARHOST>" girar-show "$@"
GIT_ALT=$GEARHOST girar-show "$@" | sed 's/\x1b\[[0-9;]*m//g'
else
showcmd "$GEARHOST>" 'girar-show | head -n20'
GIT_ALT=$GEARHOST girar-show | head -n20
echo "(end of head -n20 output)"
fi
exit exit
fi fi
...@@ -385,12 +408,7 @@ if [ "$1" = "show" ] ; then ...@@ -385,12 +408,7 @@ if [ "$1" = "show" ] ; then
if [ -z "$TASK" ] ; then if [ -z "$TASK" ] ; then
TASK="$(get_last)" || fatal "Can't get last task" TASK="$(get_last)" || fatal "Can't get last task"
fi fi
if [ -n "$VERBOSE" ] ; then do_task_show "$TASK" "$VERBOSE"
docmd ssh $GEARHOST task show "$TASK"
else
showcmd "$GEARHOST>" girar-show "${TASK}@"
GIT_ALT=$GEARHOST girar-show "${TASK}@"
fi
exit exit
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment