fix: lazysecrets list keeps each entry on one line, errors to their first
This commit is contained in:
3 files changed
+29
-2
No files matched your search
@@ -72,7 +72,8 @@ func listCmd(providers []provider.Provider, cachePath string, timeout func(provi
|
||||
switch *format {
|
||||
case "text":
|
||||
write = func(e listing.Entry) error {
|
||||
_, err := fmt.Fprintf(out, "%s\t%s\n", nameOf(e, theme, iconSet, *color == "always"), e.Link)
|
||||
// A tab or line break in a name would break the line up.
|
||||
_, err := fmt.Fprintf(out, "%s\t%s\n", oneLine.Replace(nameOf(e, theme, iconSet, *color == "always")), e.Link)
|
||||
return err
|
||||
}
|
||||
case "json":
|
||||
@@ -121,6 +122,8 @@ func listCmd(providers []provider.Provider, cachePath string, timeout func(provi
|
||||
return nil // or the reader has what it wanted
|
||||
}
|
||||
|
||||
var oneLine = strings.NewReplacer("\t", " ", "\r\n", " ", "\n", " ", "\r", " ")
|
||||
|
||||
// nameOf is an entry's name for the text format: the provider's icon,
|
||||
// the path with the item's own name standing out, and the account. A
|
||||
// list that couldn't be read has ✗ for the icon, and why after it.
|
||||
|
||||
Reference in new issue
Block a user