diff options
author | merakor <cem@ckyln.com> | 2020-07-24 06:26:42 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-07-24 06:26:42 +0000 |
commit | 20d611a50fd1960cf238bed0ae5617f207f0714c (patch) | |
tree | b09266170639d654dde1c8621f3ee72dd022f28c /cpt | |
parent | 226c922903177ec04bf4078d1688f1224b33c94b (diff) | |
download | cpt-20d611a50fd1960cf238bed0ae5617f207f0714c.tar.gz |
start CPT experiment
FossilOrigin-Name: ffc3bb708f947ab9c2797830e6abc26abf1dc1fa93527b3e0d93071c311f3e94
Diffstat (limited to 'cpt')
-rwxr-xr-x | cpt | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#!/bin/sh -ef +# shellcheck disable=1091 + +if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./lib.sh; fi + +case "$1" in + --help|-h|'') + log "Carbs Packaging Tool" + set -- + for path in $(SEARCH_PATH=$PATH pkg_find cpt-* all -x); do + set -- "${path#*/cpt-}" "$@" + max=$((${#1} > max ? ${#1} : max)) + done + + for path in "$@"; do + # These are binary files so they should be ignored + contains "readlink stat" "$path" && continue + + printf "%b->%b %-${max}s " "${color:+\033[1;31m}" "${color:+\033[m}" "${path#*/cpt-}" + sed -n 's/^# *//;2p' "$(command -v "cpt-$path")" + done | sort -uk1 >&2 + ;; + + --version|-v) version ;; + + *) + util=$(SEARCH_PATH=$PATH pkg_find "cpt-$1"* "" -x 2>/dev/null) || + die "'cpt $action' is not a valid command" + + shift; "$util" "$@" + ;; + +esac |