[feat] Use newlines in list
when stdout is a tty or when passed -1
#54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello again @brianp 👋
Been using muxed constantly for the past few years and continue to love it! 💜
I was looking to revamp some of my tmux stuff recently and was getting annoyed with my
sed
hacks to get newline delimited results out oflist
😆So here is proper support for tty detection, as well as an option to force one item per line (following
ls
s-1
options)I was going to look into adding some test cases for that, but realized the first road block is that we don't have a great way to capture stdout in the tests, which makes it hard to write good tests for this list sub-command.
I've used
assert_cmd
for this in the past, but not sure if there are better options or ways of doing this. Another option I found is maybe extracting out the writing to stdout. Maybe by passing in a writer that can write to stdout for the binary and a buffer for tests? (https://users.rust-lang.org/t/how-to-test-output-to-stdout/4877/3)My Example with assert_cmd: https://github.com/coreyja/devicon-lookup/blob/master/tests/strip_ansi.rs (Uses a
1.x
version it looks like, just FYI)Crate Docs: https://docs.rs/assert_cmd/2.0.2/assert_cmd/
Do you have thoughts on how you would like to do testing?
Fixes #53