Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]list when piped should be New Line deliminated #53

Open
coreyja opened this issue Dec 7, 2020 · 2 comments · May be fixed by #54
Open

[Feature Request]list when piped should be New Line deliminated #53

coreyja opened this issue Dec 7, 2020 · 2 comments · May be fixed by #54

Comments

@coreyja
Copy link
Contributor

coreyja commented Dec 7, 2020

System Info

OS: Mac OS 11.1
Muxed Version: v0.8.2

Description

When piped muxed list displays all projects on the same line

While this looks great when used interactively in the terminal, when piped and used in scripts its more common and more useful to be delimited by newlines. Realized this in my current workflow where I am using sed to replace tabs with newlines to make muxed list more script-able

Workarounds

This can be workaround by using sed. The following produces new line delimited output

muxed ls | sed -e "s/\t\t/\n/g"

Steps to reproduce

  • muxed ls | cat

Expected

project_1
project_2
project_3

Actual

project_1 project_2 project_3

@coreyja
Copy link
Contributor Author

coreyja commented Dec 7, 2020

Looking into this a bit the atty crate seems like the cross-platform way to do this (detect if the Stream is a TTY). https://crates.io/crates/atty

Would that be an acceptable dependency to add to help with this feature?

@brianp
Copy link
Owner

brianp commented Dec 14, 2020

I think the dep is worthwhile. I'd also be interested in following GNU's ls path of using the flag -1

-1 (The numeric digit ``one''.) Force output to be one entry per line. This is the default when output is not to a terminal.

So even if in a TTY you can pass the flag and receive the one item per line output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants