cloneit
cloneit copied to clipboard
[Feature Request] silent run
Thanks for this great piece of software, I've been using it with joy on several (family) Linux machines. Recently I've been scripting
a few things and I wonder if there's a way to suppress cloneit's default (colorized) output. A -s
or --silent
option would be awesome for such use cases.
Regards
Hello @glitsj16 ,
Good suggestion 👌! We're gonna look into developing that kinda functionality
Hi @glitsj16,
Sorry I've been away from the project for a while, glad to hear it was useful to you. Could you tell me more about your use case? Disabling colorized outputs for normal texts is pretty straightforward, and I can add a -s or --silent option. However, removing the color from the progress bar would require some extra steps. Do you need the progress bar to be non-colored as well?
Hi @alok8bb,
Nice to hear from you. My scripting use case for cloneit tends to be tied into Arch Linux package building
. Basically using cloneit to download only the needed files from a git repo and proceeding with the build. Arch extensively uses makepkg in this context, and that already does colorizing of its own. To avoid clashes I'd only need/appreciate what you describe as the straightforward disabling of colorized outputs for normal texts.
Hope this clears things up, regards!
A common way of dealing with that is the NO_COLOR
environment variable: https://no-color.org/. We could add support for this, as well as a flag.
Hi @uncenter,
I'm familiar with the NO_COLOR
env var, so having support for that in cloneit would be awesome. Thanks to the cloneit team to look into this, appreciated.
However, removing the color from the progress bar would require some extra steps. Do you need the progress bar to be non-colored as well?
I'd be in favor of removing the progress bar altogether (I don't find it particularly helpful, especially as it only ticks upwards for the size of files rather than the total number of files, and I'm not even sure the latter idea is possible), or maybe only display if not in CI (https://crates.io/crates/is_ci)?
Hi @uncenter,
Hmm true progress bar is kinda useless I just added it for fun but it's good to have some sort of progress indicator. 🤔
About the other issue, I was unfamiliar with the NO_COLOR
env variable, but if it works we can certainly add that. Another approach I considered was creating a wrapper function for the .colorize
method of the kdam
crate. Based on a new flag -s
or --silent
, we could return the string either with or without colors. For the progress bar, the silent flag can be passed down to the file that creates the progress bar and generate a different type of progress bar—perhaps one that displays progress in a text-only format, also using kdam
.
Based on a new flag -s or --silent, we could return the string either with or without colors.
I don't think this is the way it should be done; log verbosity and the presence of colors are not the same thing and should not be controlled by the same flag. Log verbosity should be with a --quiet
/-q
and/or --verbose
/-v
, and the presence of colors should be controlled by the aforementioned environment variables.
I don't think this is the way it should be done; log verbosity and the presence of colors are not the same thing and should not be controlled by the same flag.
I was referring to the text coloring, which is not related to the progress bar. The code uses a simple colorize
function from the kdam
library to return the colored string. This was an approach I had considered before learning about the NO_COLOR
environment variable.
Hello @glitsj16,
NO_COLOR
support is merged, now you can run cloneit without colors. 🤠
Much thanks to @uncenter for https://github.com/alok8bb/cloneit/pull/12
I don't think this closes the original issue though about having a --verbose
/--quiet
flag though btw.