commit 1fab48c8ae8366012d7606dc41cc3e5d0815cf2b
parent 0e175033e177ff35e4bc310882e3b83ff92710f1
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 9 Jul 2023 08:15:53 -0400
asking to show/clip a non-existing entry should be an error
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/internal/app/showclip.go b/internal/app/showclip.go
@@ -29,7 +29,7 @@ func ShowClip(cmd CommandOptions, isShow bool) error {
return err
}
if existing == nil {
- return nil
+ return errors.New("entry does not exist")
}
if isShow {
fmt.Fprintln(cmd.Writer(), existing.Value)
diff --git a/internal/app/showclip_test.go b/internal/app/showclip_test.go
@@ -22,7 +22,7 @@ func TestShowClip(t *testing.T) {
}
m.buf = bytes.Buffer{}
m.args = []string{"test211/test2/test"}
- if err := app.ShowClip(m, true); err != nil {
+ if err := app.ShowClip(m, true); err == nil || err.Error() != "entry does not exist" {
t.Errorf("invalid error: %v", err)
}
if m.buf.String() != "" {