serokell / coffer

Multi-backend password store with multiple frontends
4 stars 2 forks source link

[BUG] The output of `set-field` is malformed when fieldcontents is multi-line #38

Closed dcastro closed 2 years ago

dcastro commented 2 years ago

Description

When you use set-field to create a new field/update an existing field with a fieldcontents that contains multiple lines, the command's output looks "messy" (see example below). The new fieldcontents is split across multiple lines and mixed together with the success message.

As part of this issue, let's also take the time to make sure every single command behaves correctly in the presence of multi-line fieldcontents, and write the appropriate tests.

To Reproduce

Steps to reproduce the behavior:

$ coffer create /path
$ coffer set-field /path user "$(echo -e "first\n\nsecond")"
[SUCCESS] Set field 'user' to 'first

second' (public) at '/path'.

Expected behavior

Expected the new fieldcontents to be clearly separated from the success message. Maybe something like this:

[SUCCESS] Set field 'user' (public) at '/path' to:
first

second

Environment