lispyclouds / bblgum

An extremely tiny and simple wrapper around charmbracelet/gum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gum style doesn't seem to work

licht1stein opened this issue · comments

Thanks for the excellent lib! I have a problem -- everything seems to work, but gum style. This works fine in terminal:

gum style foo

But this produces no output:

(gum {:cmd :style :args ["foo"]})

Thanks! I see this with the latest version of gum:

user=> (require '[bblgum.core :as b])
nil
user=> (b/gum {:cmd :style :args ["foo"]})
{:status 0, :result ("foo")}

Seems to be inline with the CLI I think?

Yes, but doesn't print. Also while scripting with your lib today I think I came up with a simpler API. I'll make a pr for you to take a look.

but doesn't print

Do you mean it doesn't style the output? Or there is no output? Could you be specific about print?

I came up with a simpler API

Really looking forward to it!

If you're expecting the call to style should produce output to the stdout of the script, that wouldn't happen directly. The :result needs to be handled.

Here it is, more or less: #3

Thanks! Taking a look at it. But does the issue with no printing still exist?

Yes, nothing is printed

Again, when you say printed, on the stdout of the script? If yes, that wont work as it is, you need to run println or something similar on the seq of the :result. The stdout of gum is piped into gum and thats how it gets the output back. There is no direct side effects from gum on its stdout.

Is this really an issue? Im not quite sure of it?

You need to update the git sha in the readme.

And I'll demonstrate the issue in a min

should be pointing to the butlast one now.

image

Is this the expected behaviour? Cause it seems strange, that I can't use it as part of the flow.

yes this is expected. the output of gum is on its stdout and is intercepted by bb and into the result map youre seeing. if gum wouldve printed on stderr it wouldve been the way youre expecting? this causes it: https://github.com/lispyclouds/bblgum/blob/main/src/bblgum/impl.clj#L23

you can do something like (run! println result) where result is the seq.

I wonder, how gum clears the output after, for example, printing a table or confirmation dialogue. Because I want disappearing prints :)

But I understand your answer, it seems there is no issue after all.

I wonder, how gum clears the output after, for example, printing a table or confirmation dialogue

Gum is doing it on stderr which we inherit, thats how it works. we can think of a way to inherit stdout too. it complicates the communication with gum a bit though as the answer comes there for others. any ideas welcome!

Could you try passing :as :ignored and see if it produces the output you want?

image

yes, it does, thanks!