From 5b8c342bfbedbd6b49f58c1dc8742a21d97d3a8f Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Mon, 18 Nov 2019 13:54:15 +0100 Subject: Status tool. Initial on tool to review minutes status. --- tools/status | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tools/status diff --git a/tools/status b/tools/status new file mode 100755 index 0000000..a95737d --- /dev/null +++ b/tools/status @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +y=$(basename $(pwd)) +b=$(git branch | grep '\*' | tr '*' ' ') + +if ! [[ $y =~ ^[0-9]*$ ]]; then + echo "${0##*/}: E: Not year. Exit." + exit 1 +fi + +echo "Minues tex files $y on $b:" +ls -1 $y*.tex | while read f; do + wc=$(cat $f | sed '/begin{document}/,/end{document}/ p; d' | wc -w) + echo " $(printf '%s %4.d' $f $wc)" +done + +echo "Local branches of $y:" +git branch | grep "master\|$y" | tr '*' ' ' \ + | xargs -I{} -n1 git log -n1 \ + --pretty=format:" {} - %h -%d%n %s%n (%an, %ad, %cr)" {} + -- cgit v1.2.3 From 7a1de6197e92fa6653de3de64ea23dcba2f0f776 Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Mon, 18 Nov 2019 16:36:30 +0100 Subject: Status tool. Make the tool useful also generally Other repositories have use also for branch information and summaries. * Make output callable as functions * Add some function for general branch reporting --- tools/status | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/tools/status b/tools/status index a95737d..f053ef4 100755 --- a/tools/status +++ b/tools/status @@ -1,21 +1,48 @@ #!/usr/bin/env bash + y=$(basename $(pwd)) b=$(git branch | grep '\*' | tr '*' ' ') -if ! [[ $y =~ ^[0-9]*$ ]]; then - echo "${0##*/}: E: Not year. Exit." - exit 1 +# Control + +all= +year=true + +case $1 in + -v) all=true ;; +esac + +if ! [[ $y =~ ^[0-9]*$ ]]; then # Not a year + year= + all=true fi -echo "Minues tex files $y on $b:" -ls -1 $y*.tex | while read f; do - wc=$(cat $f | sed '/begin{document}/,/end{document}/ p; d' | wc -w) - echo " $(printf '%s %4.d' $f $wc)" -done -echo "Local branches of $y:" -git branch | grep "master\|$y" | tr '*' ' ' \ - | xargs -I{} -n1 git log -n1 \ - --pretty=format:" {} - %h -%d%n %s%n (%an, %ad, %cr)" {} +function year_branches { + echo "Minues tex files $y on $b:" + ls -1 $y*.tex | while read f; do + wc=$(cat $f | sed '/begin{document}/,/end{document}/ p; d' | wc -w) + echo " $(printf '%s %4.d' $f $wc)" + done + echo "Local branches of $y:" + git branch | grep "master\|$y" | tr '*' ' ' \ + | xargs -I{} -n1 git log -n1 \ + --pretty=format:" {} - %h -%d%n %s%n (%an, %ad, %cr)"\ + {} +} + +function all_branches { + echo "All branches (commiter date, author date, hash, branch):" + git branch -a | tr '*' ' ' | grep -v HEAD \ + | xargs -n1 git log -n1 \ + --date=short \ + --pretty=format:' %cd %ad %h -%d%n' \ + | sort -u +} + +if [[ "${0##*/}" == "status" ]]; then + test -n "$year" && year_branches + test -n "$all" && all_branches +fi -- cgit v1.2.3