Earlier quoted context omitted.
The XWindow system used -long -opts long before that.
...aaaand it's more than 20 years old, so yeah, that kinda agrees with the point that it took us a long time to stop doing that because it's confusing.
Big list of HTTP static server one-liners
71–80 of 100 posts
Re: Big list of HTTP static server one-liners
#72Earlier quoted context omitted.
> go has popularized long args, with a single hyphen (-name etc) Why did they do that? It took us 20 years to standardize on - for short and -- for long, with occasional finger rage on tar or find, and now this? What were they thinking?
> What were they thinking? They were starting back from the 70s. Also one more check for go being alt.history.java, this style is also the standard for Java tooling. And Apple, I think.
Re: Big list of HTTP static server one-liners
#73I often use netcat to test stuff locally. while true; do cat index.html | nc -l 9999 -q 1; echo -e "\n---"; done
Re: Big list of HTTP static server one-liners
#74Re: Big list of HTTP static server one-liners
#75If you have npm installed then simply doing npx serve is very easy
Re: Big list of HTTP static server one-liners
#76Is there a way of doing that in a Windows without installing anything?
Re: Big list of HTTP static server one-liners
#77I'm always surprised that nginx doesn't have a nice way to run as a single-liner command.
I think it makes sense since it is completely driven by its config and adheres to the Unix philosophy of doing one thing well and not clutter the binary with additional stuff for fringe use cases. It would make the now surprisingly simple cli arguments more complex. It should be trivial to write a shell script or alias that templates `root $(pwd);` and invokes `nginx -c /tmp/nginx.conf`
Nginx? Really? "One" thing? Try running `./configure --help` in the Nginx source dir...
Re: Big list of HTTP static server one-liners
#78Weird to call these one liners, they're just invocation commands. By that logic, apache is a one-liner.
apache requires a config file. I guess you could put any relevant config into a single line and pipe that through somehow, but it would be a lot more than a single command to define a directory and a port to serve.
Re: Big list of HTTP static server one-liners
#79You could do `npx http-server` I believe.
Re: Big list of HTTP static server one-liners
#80Earlier quoted context omitted.
Probably because the example you made doesn't look like a static file server, it seems to execute a specific unix command on incoming request only. The rest of the examples from the gist is proper static file servers. I'd be interested in seeing if you can come up with a socat one-liner that works like a static file server. Would come in handy for many things, but I can't seem to figure out how to make it work.
Many examples here in the comments and in the gist itself don't follow it to the letter either, it's easy enough to serve one file. This one might work https://github.com/avleen/bashttpd > socat TCP4-LISTEN:8080 EXEC:/usr/local/bin/bashttpd
Curious about what you said, I looked through the gist again and every one of the examples in the gist itself does indeed serve all the files under a path (a "static file server"). Which one are you implying does not?