From 61e464e037a7436a2ac050fac8258094ba095514 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Wed, 8 Mar 2023 08:58:54 +0100
Subject: Add diff subcommand
---
lib/main.bash | 2 ++
lib/subcommands/diff.bash | 11 +++++++++++
lib/subcommands/patch.bash | 15 ---------------
3 files changed, 13 insertions(+), 15 deletions(-)
create mode 100644 lib/subcommands/diff.bash
delete mode 100644 lib/subcommands/patch.bash
diff --git a/lib/main.bash b/lib/main.bash
index 6a8d7e8..12033db 100644
--- a/lib/main.bash
+++ b/lib/main.bash
@@ -77,6 +77,7 @@ Usage:
$BASHTARD_NAME -h
$BASHTARD_NAME add
$BASHTARD_NAME del
+ $BASHTARD_NAME diff
$BASHTARD_NAME init [repository]
$BASHTARD_NAME pkg
$BASHTARD_NAME ssh
@@ -92,6 +93,7 @@ Commands:
init Initialize the $BASHTARD_NAME configuration system.
pkg Interface into the pkg abstraction used by $BASHTARD_NAME.
del Remove a configuration playbook from this machine.
+ diff Show a diff of all uncommitted changes.
ssh Run a given command on all known hosts.
sync Pull latest changes through git, and synchronize all added
playbooks.
diff --git a/lib/subcommands/diff.bash b/lib/subcommands/diff.bash
new file mode 100644
index 0000000..1cb8c71
--- /dev/null
+++ b/lib/subcommands/diff.bash
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+# SPDX-FileCopyrightText: 2022 Patrick Spek
+#
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+subcommand()
+{
+ chgdir "$BASHTARD_ETCDIR"
+ git -C "$BASHTARD_ETCDIR" diff
+}
diff --git a/lib/subcommands/patch.bash b/lib/subcommands/patch.bash
deleted file mode 100644
index 72350ef..0000000
--- a/lib/subcommands/patch.bash
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-# SPDX-FileCopyrightText: 2022 Patrick Spek
-#
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-subcommand()
-{
- chgdir "$BASHTARD_ETCDIR"
- git add . \
- && git diff --cached \
- && git reset \
- && git restore . \
- && git clean -fd
-}
--
cgit v1.1