From a8be7423efb287edd5ef80002a75a853fc0c9c1d Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Mon, 12 Sep 2022 01:34:08 +0200 Subject: pkgctl: add a unified command-line frontend for devtools This is the first step of a simple and highly structured unified interface to devtools commands in a single wrapper. The split is based on groups like `repo`, `build` and `diff` Signed-off-by: Levente Polyak --- src/pkgctl.in | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/pkgctl.in (limited to 'src/pkgctl.in') diff --git a/src/pkgctl.in b/src/pkgctl.in new file mode 100644 index 0000000..9b7d89c --- /dev/null +++ b/src/pkgctl.in @@ -0,0 +1,56 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +m4_include(lib/common.sh) + +set -e + + +usage() { + local -r COMMAND=${BASH_SOURCE[0]##*/} + cat <<- _EOF_ + Usage: ${COMMAND} [COMMAND] [OPTIONS] + + Unified command-line frontend for devtools. + + COMMANDS + diff Compare package files using different modes + repo Manage Git packaging repositories and their configuration + + OPTIONS + -h, --help Show this help text +_EOF_ +} + +if (( $# < 1 )); then + usage + exit 1 +fi + +export _DEVTOOLS_COMMAND='pkgctl' + +# command checking +while (( $# )); do + case $1 in + -h|--help) + usage + exit 0 + ;; + repo) + _DEVTOOLS_COMMAND+=" $1" + shift + pkgrepo "$@" + exit 0 + ;; + diff) + _DEVTOOLS_COMMAND+=" $1" + shift + diffpkg "$@" + exit 0 + ;; + *) + die "invalid command: %s" "$1" + ;; + esac +done -- cgit v1.2.3-70-g09d2