Giter Club home page Giter Club logo

Comments (3)

reorx avatar reorx commented on May 5, 2024

After digging around with curl for a while, I found that

It would be nice if httpstat did not depend on the position of the URL

is very hard to achieve. curl actually don't care the position of URL, whether URL is at first, or last, or in the middle, as long as the other arguments follow the rules, curl can parse the inputs correctly.

As to httpstat, we couldn't just pass all the arguments to curl directly, we have to find out the URL to decide whether to use http or https display template. Specify position is the easiest way to help getting the URL, if not specify, we have to implement an argument parser the same as curl's, which is not an easy work. In that case, whether the position is first or last doesn't make much difference, since both will still have invocation valid to curl but invalid to itself. What do you think?

from httpstat.

bbiskup avatar bbiskup commented on May 5, 2024

Thank you for the prompt reply. I think replicating curl's command-line parsing or adding a library dependency would overkill. Nevertheless, I would suggest a comment making it clear to first-time users that the URL needs to be given first, because

  • curl --help gives prints this usage:
    curl [options...] <url>
  • the curl manpage gives examples with options and URL in any order

Anyway, it is a minor issue or even just a matter of habit.

from httpstat.

reorx avatar reorx commented on May 5, 2024

Actually the usage has made it clear that the URL should be put at the first position:

$ python httpstat.py
Usage: httpstat URL [CURL_OPTIONS]
       httpstat -h | --help
       httpstat --version

The time I was considering the URL's position, I was thinking that httpstat itself actually has no option. So it should be distinguished from normal situation, where intuitively options are put after command and before the main arguments. Thus when you see httpstat URL [CURL_OPTIONS], it becomes very clear that the curl options are just for curl, and will definitely have no effect on how httpstat will perform. All the options for httpstat, are environment variables, separately.

In conclusion, the position of URL won't be changed, thanks for your suggestion and cooperation :)

P.S. it's easy to modify the code for your own to make URL at the last position, just change L180 to url = args[-1] and L88 to curl_args = args[:-1].

from httpstat.

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.