mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
Return with an error code when searching after not finding password (#198)
* Return with an error code when searching after not finding password * Fix integration tests for returning error code when running search
This commit is contained in:
parent
d249f0077d
commit
5229378b8d
@ -2,6 +2,7 @@ package action
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
"github.com/fatih/color"
|
||||
@ -72,7 +73,10 @@ func (s *Action) Show(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
color.Yellow("Entry '%s' not found. Starting search...", name)
|
||||
return s.Find(c)
|
||||
if err := s.Find(c); err != nil {
|
||||
return err
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@ func TestSingleMount(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
out, err = ts.run("show mnt/m1/secret")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "Entry 'mnt/m1/secret' not found. Starting search...", out)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, "Entry 'mnt/m1/secret' not found. Starting search...\n", out)
|
||||
|
||||
ts.initSecrets("mnt/m1/")
|
||||
|
||||
|
||||
@ -20,8 +20,8 @@ func TestShow(t *testing.T) {
|
||||
assert.Equal(t, "\nError: provide a secret name\n", out)
|
||||
|
||||
out, err = ts.run("show foo")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "Entry 'foo' not found. Starting search...", out)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, "Entry 'foo' not found. Starting search...\n", out)
|
||||
|
||||
ts.initSecrets("")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user