feat(table): Add interactive flag for #800#806
feat(table): Add interactive flag for #800#806MTHLily wants to merge 2 commits intocharmbracelet:mainfrom
Conversation
| } | ||
|
|
||
| if o.Print || !term.IsTerminal(os.Stdout.Fd()) { | ||
| if !o.Interactive && (o.Print || !term.IsTerminal(os.Stdout.Fd())) { |
There was a problem hiding this comment.
I think maybe we should check if stdin is a terminal instead 🤔
There was a problem hiding this comment.
Implemented your suggestions, @caarlos0. However, the behavior is inconsistent for the following cases:
results="$(gum table --height 10 -f test.csv)" # Results in an interactive table
results="$(gum table --height 10 <test.csv)" # Results in a printed table
results="$(cat test.csv | gum table --height 10)" # Results in a printed tableThere was a problem hiding this comment.
Reflecting on the way gum table is meant to be used and described in the readme, i.e. as a row selector for tabular data, I'm thinking that instead of adding the forced interactive flag, we ought to revert the original commit from #762. I don't think it's expected behavior for gum table to print a table instead of letting us choose a row.
Cards on the table, I was also using gum table to select row data and piping it to another program for my own script. So, I am a bit biased in this regard.
There was a problem hiding this comment.
yes, in retrospect, I think that it makes sense. will do it
|
Hey, looks like this was closed in #811. Thanks so much for the contribution :) If you have any questions or concerns about this PR, please let us know and we can reopen. |
Fixes #800
Changes
--interactive/-iflag to restore previous functionality to select a table row then pipe it into another command