Giter Club home page Giter Club logo

Comments (9)

nugaon avatar nugaon commented on May 31, 2024 1

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'.

from swarm-cli.

nugaon avatar nugaon commented on May 31, 2024 1

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.

from swarm-cli.

agazso avatar agazso commented on May 31, 2024 1

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.

from swarm-cli.

nugaon avatar nugaon commented on May 31, 2024

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

from swarm-cli.

AuHau avatar AuHau commented on May 31, 2024

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 [email protected] which won't be possible if you can't get only the resulting hash.

from swarm-cli.

nugaon avatar nugaon commented on May 31, 2024

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.

from swarm-cli.

significance avatar significance commented on May 31, 2024

+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

from swarm-cli.

significance avatar significance commented on May 31, 2024

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

from swarm-cli.

agazso avatar agazso commented on May 31, 2024

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

from swarm-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.