muxed icon indicating copy to clipboard operation
muxed copied to clipboard

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

Open coreyja opened this issue 3 years ago • 2 comments

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 avatar Dec 07 '20 03:12 coreyja

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?

coreyja avatar Dec 07 '20 03:12 coreyja

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.

brianp avatar Dec 14 '20 14:12 brianp