igor-petruk / scriptisto

A language-agnostic "shebang interpreter" that enables you to write scripts in compiled languages.
Apache License 2.0
943 stars 24 forks source link

Feature request: Showing build progress indicator and/or build command output #27

Closed d4h0 closed 1 year ago

d4h0 commented 4 years ago

I just tried to execute the default Rust template, and it took a long time to build. The problem is, that there is no indicator of what is happening. I think, there should at least be a message like "Building XY, this could take a few seconds...").

It's easy to add this functionality with a custom 'build_cmd' value, but I thought it would be useful to provide some feedback regarding something that potentially is confusing to end-users (end-users of a script). If they have to wait 30 seconds until something happens, then some users most likely will be confused a bit.

A progress indicator would be ideal, but difficult to implement. An option to show a custom message before a build would also solve the problem.

Personally, I'd like to always see the full build output, but it seems that's not possible at the moment.

igor-petruk commented 3 years ago

Hi,

Can you please describe with a console example what would you like to see?

Is the progress only for the explicit build like "scriptisto build --progress"? Or for "lazy" mode, where the tool is built at the background?

If it is the latter, then I presume some other people would prefer the exactly opposite - no progress bar.

I think I can create an environment variable to enable this mode that you can put to your profile and you'll see the bar by default. Again, this does not address

potentially is confusing to end-users

To make things not confusing I'll have to change the default. Sure, it'll go to STDERR, but even given that, I wonder if can break some flows

d4h0 commented 3 years ago

Can you please describe with a console example what would you like to see?

Personally, I'd prefer that all the build output is shown (when I opened this issue, the output was suppressed). But any output would be better than none (for example, as proposed, "Building XY, this could take a few seconds...").

Is the progress only for the explicit build like "scriptisto build --progress"? Or for "lazy" mode, where the tool is built at the background?

"Lazy" mode

If it is the latter, then I presume some other people would prefer the exactly opposite - no progress bar.

I'm using Arch Linux with i3 as window manager (so no full desktop environment), and I know that many people prefer this setup.

Do I think this is the best setup for every user? No, of course not.

So the question here, in regard to Scriptisto, is: Is this the best default behavior?

I don't think, not showing any indicator for potentially several minutes is a great default behavior, to be honest.

I think I can create an environment variable to enable this mode that you can put to your profile and you'll see the bar by default.

As far as I remember, it's easy to add an indicator as a user (above I wrote "It's easy to add this functionality with a custom 'build_cmd' value"). This problem happens mostly to people who don't read the docs, I guess. And an environment variable wouldn't be useful to these people.

To make things not confusing I'll have to change the default.

Yes, this would be a breaking change. But I think it would be worth it.

Sure, it'll go to STDERR, but even given that, I wonder if can break some flows

I wouldn't expect that the output would go to stderr. And I'm pretty sure that would lead to more problems than keeping the output on stdout (some people could check stderr, and assume that there was a problem, if there is something)

W1M0R commented 2 years ago

It would be helpful having an environment variable that could enable the showing of build output (or at the least that a build is in progress) whenever scriptisto performs a build.

For example:

# this could be: progress (show message indicating that a build is in progress), output (show the actual output of the build command)
export SCRIPTISTO_BUILD_OUTPUT=progress

Alternatively, a build_msg option could be added to the yaml configuration:

build_msg: "Script being compiled, please wait..."

The idea being that users of the script will realise that the script is not hanging, but actually being built in the background.

W1M0R commented 2 years ago

I came across the following environment variable in the source code: SCRIPTISTO_BUILD_LOGS.

Setting the variable, produces the build output that I was looking for:

export SCRIPTISTO_BUILD_LOGS=1
igor-petruk commented 1 year ago

I am tentative to close this, as while it might have been better to show something as a default behavior, adding it now may taint stderr of existing users who might parse it or rely on it in unexpected ways.

I could still do SCRIPTISTO_BUILD_OUTPUT=progress or similar as a non default behavior, so no user setup is broken.

I should also probably update the documentation to warn users that absolutely no output by default is expected.