#!/bin/sh colorize_ver() { color="${1:-3}" perl -pe 's,(\d[\d.]+),\x1b[1;3'$color'm$1\x1b[0m,x' } sort_color() { sort -V | colorize_ver } last_gh_commit() { # only show latest commit head -1 | sed 's,.*::Commit/\([^<]*\),\1,' } last_gh_tag() { # only show latest commit head -1 | sed 's,.*/v*\([^/]*\)&1 ; exit 0 ;; *" "*) echo "$build is in multiple configs: $conf" 2>&1; exit 0;; *) ;; esac if grep -q "^$build .*github.*commits.atom" $conf; then postproc="last_gh_commit" elif grep -q "^$build .*github.*tags.atom" $conf ; then postproc="last_gh_tag" elif [ "$build" = "quark" ]; then postproc="head -1" elif [ "$conf" = "$DIR/repology.conf" ]; then postproc="format_repology" else postproc="sort_color" fi ck4up -dk -f "$conf" "^$build\\s" | $postproc source ./*.info echo "===> VERSION=$VERSION" | colorize_ver 2