Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/pkgctl.in
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-09-12 01:34:08 +0200
committerLevente Polyak <anthraxx@archlinux.org>2023-05-19 22:27:12 +0200
commita8be7423efb287edd5ef80002a75a853fc0c9c1d (patch)
tree327592b654c18c8b66d0919570f7cdc973c65e04 /src/pkgctl.in
parentd15bd29a9d411dedc0a0682ec54b55e079d4f00f (diff)
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 <anthraxx@archlinux.org>
Diffstat (limited to 'src/pkgctl.in')
-rw-r--r--src/pkgctl.in56
1 files changed, 56 insertions, 0 deletions
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