commit 064cbd4342fa206c4e70e41a83d73e680c029a42
parent b8485253f70058222a564adc152d6a6fb31f5b5b
Author: Sean Enck <sean@ttypty.com>
Date: Fri, 15 Jul 2022 18:10:43 -0400
renaming diff
Diffstat:
5 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
VERSION := development
DESTDIR :=
BUILD := bin/
-TARGETS := $(BUILD)lb $(BUILD)lb-rw $(BUILD)lb-bash $(BUILD)lb-rekey $(BUILD)lb-diff $(BUILD)lb-totp
+TARGETS := $(BUILD)lb $(BUILD)lb-rw $(BUILD)lb-bash $(BUILD)lb-rekey $(BUILD)lb-textconv $(BUILD)lb-totp
LIBEXEC := $(DESTDIR)libexec/lockbox/
all: $(TARGETS)
diff --git a/README.md b/README.md
@@ -88,7 +88,7 @@ lb totp -c token
To manage the `.lb` files in a git repository and see _actual_ text diffs and this to a `.gitconfig`
```
[diff "lb"]
- textconv = lb diff
+ textconv = lb textconv
```
## build
diff --git a/cmd/lb-diff/main.go b/cmd/lb-diff/main.go
@@ -1,23 +0,0 @@
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/enckse/lockbox/internal"
-)
-
-func main() {
- args := os.Args
- l, err := internal.NewLockbox(internal.LockboxOptions{File: args[len(args)-1]})
- if err != nil {
- internal.Die("unable to make lockbox model instance", err)
- }
- result, err := l.Decrypt()
- if err != nil {
- internal.Die("unable to read file", err)
- }
- if result != nil {
- fmt.Println(string(result))
- }
-}
diff --git a/cmd/lb-textconv/main.go b/cmd/lb-textconv/main.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/enckse/lockbox/internal"
+)
+
+func main() {
+ args := os.Args
+ if len(args) != 3 {
+ internal.Die("input entry required", internal.NewLockboxError("entry argument required"))
+ }
+ l, err := internal.NewLockbox(internal.LockboxOptions{File: args[len(args)-1]})
+ if err != nil {
+ internal.Die("unable to make lockbox model instance", err)
+ }
+ result, err := l.Decrypt()
+ if err != nil {
+ internal.Die("unable to read file", err)
+ }
+ if result != nil {
+ fmt.Println(string(result))
+ }
+}
diff --git a/tests/run.sh b/tests/run.sh
@@ -45,7 +45,7 @@ _run() {
echo "5ae472abqdekjqykoyxk7hvc2leklq5n" | "$BIN/lb" insert test/totp
"$BIN/lb-totp" -ls
"$BIN/lb-totp" test | tr '[:digit:]' 'X'
- "$BIN/lb-diff" bin/lb/keys/one.lb bin/lb/keys/one2.lb
+ "$BIN/lb-textconv" bin/lb/keys/one.lb bin/lb/keys/one2.lb
yes 2>/dev/null | "$BIN/lb" rm keys2/three
echo
yes 2>/dev/null | "$BIN/lb" rm test/totp