Giter Site home page Giter Site logo

Comments (4)

kareman avatar kareman commented on June 2, 2024 1

I just released 5.1.0.

I'll close this issue now as the original issue has been resolved, but feel free to open new issues if you have further suggestions on how to improve the API.

from swiftshell.

kareman avatar kareman commented on June 2, 2024

Swift 5.3 requires SwiftShell 5.1.0-beta.1 . I will release it as non-beta this week.

from swiftshell.

stherold avatar stherold commented on June 2, 2024

Nice 🎉 Really cool tool by the way :-)

Just a question for a possible improvement:
Why is run(...) not throwable too like runAndPrint? What I would like to avoid is the extra check for the error and manually print the error like this:

        let out = run("mint", args)

        if let error = out.error {
            print(out.stderror)
            throw error
        }

The following would be much cleaner imho and the failure reason could be part of the error or an underlying error maybe (error catched nd printed at higher level):

        let successfulOut = try run("mint", args)

from swiftshell.

kareman avatar kareman commented on June 2, 2024

Thank you.

You're right, it is a bit cumbersome the way it is now. The problem with your suggestion is that it makes it more cumbersome to get the result of a failing command. But your use case is probably more common.

I've been wanting to improve the API for a long time now, but I just haven't been able to come up with a good solution that handles all aspects well, like error handling, synchronicity, shell interpreter, stdin, joined or separate stdout/stderror, printing output, piping output to another command, and probably even more that I haven't thought of yet.

from swiftshell.

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.