Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default verbosity level #26

Closed
agazso opened this issue Mar 5, 2021 · 9 comments
Closed

Default verbosity level #26

agazso opened this issue Mar 5, 2021 · 9 comments
Labels
enhancement New feature or request issue

Comments

@agazso
Copy link
Member

agazso commented Mar 5, 2021

By default there is a lot of information printed on the console. It would be better to change the default verbosity level to 1 to keep it a bit down. Then if someone needs more information (for example when debugging) they can always set the verbosity level higher.

@bee-runner bee-runner bot added the issue label Mar 5, 2021
@agazso agazso added the enhancement New feature or request label Mar 5, 2021
@nugaon
Copy link
Member

nugaon commented Mar 8, 2021

Personally I think that the verbose version should be kept default because it continuously informs the user what is happening which is always good.

@AuHau
Copy link
Contributor

AuHau commented Mar 9, 2021

I would argue that the common approach to this from pretty all CLI applications and especially UNIX utilities are that you output only "the results" and have flags like -v to enable more details. This is especially important if you want to use it in some scripts and use piping to other commands. From this perspective it would be good to also have flag like --no-color or something like that, that would strip the colors chars from the stdout, but I guess it is not as critical.

I can imagine use cases like swarm-cli upload /some/dir | mail attila@ethswarm.org which won't be possible if you can't get only the resulting hash.

@nugaon
Copy link
Member

nugaon commented Mar 9, 2021

for that to set verbosity to 0 would be the way to do, because provide totally silent option is non-sense.
on upload verbosity 0 currently gives back the uploaded hash of the content, but unfortunately it also prints the progress bar which ruins this behaviour and it is not intended to be like this.

@significance
Copy link
Member

+1 for automated use

there is also the example of curl which is semi-verbose as default but has a -s option for automated use

@significance
Copy link
Member

another perhaps pertinent consideration could be how errors are communicated to the caller in bash, so that we can e.g. retry if upload fails when used in shell scripting

@nugaon
Copy link
Member

nugaon commented Mar 18, 2021

another perhaps pertinent consideration could be how errors are communicated to the caller in bash

In case of errors it exits from the application with code 1 every time. 
If some unexpected calling format has been given, we print the manual of the command which went wrong and the error message in the last row.
The Other case, when the run() method fails we print an error message with red colors, maybe with some info at the end, which depends on the verbosity level. It also throws 1 error code, that the CLI can react on (you can try out by calling swarm-cli upload some/folder/path && echo 'successful run'.

@nugaon
Copy link
Member

nugaon commented Mar 18, 2021

there is also the example of curl which is semi-verbose as default but has a -s option for automated use

as I mentioned in my comment #26 (comment) verbosity 0 is for automated usage. nevertheless if it is not intuitive for most of the users, we may introduce an alias for -v 0.

@agazso
Copy link
Member Author

agazso commented Mar 18, 2021

In many CLI tools I worked with there was a -q or --quiet option for minimal output and the -v or --verbose option for the verbose output. We can adopt that.

@agazso
Copy link
Member Author

agazso commented Mar 22, 2021

The original issue about default verbosity is fixed, follow the discussion about the new options in #54

@agazso agazso closed this as completed Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request issue
Projects
None yet
Development

No branches or pull requests

4 participants