News for hackers. Stuff that matters.
Re:“grep -R doesn't automatically search amazon” by tomrod on Tuesday September 25, 2012 @02:11PM (#4571770)
Snark aside, it's a valid point. Shouldn't CLI tools mimic GUI tools?
Re:“grep -R doesn't automatically search amazon” by VMG on Tuesday September 25, 2012 @04:18PM (#4572425)

    quake3cli --map anarki -e '(walk-forward) (rotate 0.2) (fire)'
Re:“grep -R doesn't automatically search amazon” by tedunangst on Tuesday September 25, 2012 @05:31PM (#4572778)
Sarcasm? Not the best counterexample, as that's how lots of bots work. The AI engine does not exclusively work by rendering the scene and attempting to visually identify targets.
Re:“grep -R doesn't automatically search amazon” by VMG on Wednesday September 26, 2012 @06:12AM (#4574909)
Still, there has been a lack of outcry about the absence of a quake3 command line version. Because nobody needs it.
Re:“grep -R doesn't automatically search amazon” by jimktrains2 on Tuesday September 25, 2012 @04:28PM (#4572493)
Hmm, would I use -e - or will it read from stdin if I don't supply -e?

How do I pipe to it?

Re:“grep -R doesn't automatically search amazon” by gknoy on Tuesday September 25, 2012 @07:37PM (#4573369)
I imagine you'd read from /dev/random, if you wanted to play as well as I do. All joking aside, I imagine that one could easily write a bot that allowed one to give it heuristics via STDIN or a command line parameter.

I doubt many would do it this way, but it would be consistent with the unix design ethos. One program would manage the Playing the Game and perhaps providing an API for interacting with the game, or even a pluggable section of games, and another would handle generating heuristics (or retrieving them).

Then you could, e.g.:

multibot -g quake3 --name "Rocket Llama" -h rockets.lua multibot -g quake3 --name "Ash" -h shotgun-only.lua cat /dev/urandom | multibot -g quake3 --name "Confused"

multibot -g civ3 --name "Dr. No" -h well-defended-island.lua multibot -g civ3 --name "Dr. Evil" -h meeeeelion.lua

That'd be a nightmare to implement, of course. :-)

Re:“grep -R doesn't automatically search amazon” by Flimm on Tuesday September 25, 2012 @02:19PM (#4571816)
I suppose some people might find a use for a CLI interface to the dash's search engine. Changing the behaviour of `grep -R` is definitely not the correct answer, though.
Re:“grep -R doesn't automatically search amazon” by chimeracoder on Tuesday September 25, 2012 @03:00PM (#4572040)
> Changing the behaviour of `grep -R` is definitely not the correct answer, though.

What about changing the behavior of grep -r?

(Sorry, I just couldn't resist. When I first clicked the link, I actually thought this was a reference to the GNU grep changes at first).

Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @05:43PM (#4572847)
Ding ding ding.

If you want a CLI equivalent of "ubuntu-dash", then you have to make one. grep is not it.

And as far as I am concerned, anyone who honestly finds themselves wishing cli tools worked like gui tools should knock themselves out. I'm sure plenty of people would find it useful.

Re:“grep -R doesn't automatically search amazon” by jrajav on Tuesday September 25, 2012 @02:22PM (#4571824)
You can elegantly present advertising and other non-essential elements alongside the main content of a GUI interface.

There is no elegant way to do this with a CLI interface since it is not a static interface, it is a stream of characters. Anything that's not content will have to be inline with user-generated input and output. It would be like a weather app with ads in the middle of the sun icon.

Re:“grep -R doesn't automatically search amazon” by subhro on Tuesday September 25, 2012 @02:47PM (#4571979)
>It would be like a weather app with ads in the middle of the sun icon.

The analogy is just awesome!! Thanks a ton for bringing a smile on a gloomy day :)

Re:“grep -R doesn't automatically search amazon” by tedunangst on Tuesday September 25, 2012 @03:24PM (#4572168)
The amazon results are effectively inline with regular results (placed just after, but with the same appearance). There's no reason grep could not also list a few amazon products with URLs after the regular results.
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @04:30PM (#4572501)
How frequently do you pipe the output of this ubuntu "dash" to another program?
Re:“grep -R doesn't automatically search amazon” by wtetzner on Tuesday September 25, 2012 @05:31PM (#4572779)
Maybe there should be a stdad so it won't be mixed in with the data going to stdout.
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @05:40PM (#4572829)
This is absolutely the only way such a feature could be sanely realized, and it would require so many invasive changes it is absurd.

Off the top of my head you would need to patch glibc, all the major shells, probably half of coreutils, anything that daemonizes similar to nohup (including screen and tmux, god knows how many CPAN modules), ...

Re:“grep -R doesn't automatically search amazon” by Gravityloss on Tuesday September 25, 2012 @06:30PM (#4573053)
Perhaps you could do it like the bash command time, whose output is a bit hard to capture...
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @06:42PM (#4573109)
GNU source is never a pleasure to read, but as far as I can tell the bash builtin "times" prints to stdout.

This can be observed by running:

  bash -c 'times whoami' > /dev/null
Re:“grep -R doesn't automatically search amazon” by tedunangst on Tuesday September 25, 2012 @05:26PM (#4572755)
It could write the output to stderr. Or only write it if stdout is a terminal. Or create a new window that temporarily overlays the xterm running the command.

Yes, amazon-enabled dash and grep/find/whatever have different functionality. But that's a recent change. Previously, dash had exactly the same functionality. That's the entire point. You add a feature here, you add the same feature there.

Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @05:34PM (#4572793)
So now grep prints advertisements if I have it print to a tty, but not if I have it print to a pipe that goes to a pager? Which I almost certainly would be doing if advertisements are pushing my output over 20 or so lines? That is your idea of usability? Brilliant, just brilliant. I suppose I shouldn't even bother to ask what happens if I have tty output being consumed by another program.

>Or create a new window that temporarily overlays the xterm running the command.

You have got to be kidding me. This is a joke.

>Previously, dash had exactly the same functionality

The exact same functionality of which? And I rather doubt that is true.

>You add a feature here, you add the same feature there.

No. No you do not. Not when there is standardized. And in this case the "here"/"there" relationship has not even been established for "ubuntu-dash"/grep, making this extra idiotic.

Re:“grep -R doesn't automatically search amazon” by hackmiester on Tuesday September 25, 2012 @07:06PM (#4573226)
>This is a joke.

Uh, yeah?

Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @07:09PM (#4573245)
This thread started with "Snark aside, it's a valid point. Shouldn't CLI tools mimic GUI tools?"
Re:“grep -R doesn't automatically search amazon” by sadga on Tuesday September 25, 2012 @05:27PM (#4572756)
Put the ads on stderr
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @05:35PM (#4572798)
Why should polluting stderr be seen as any better than polluting stdout?
Re:“grep -R doesn't automatically search amazon” by Dylan16807 on Tuesday September 25, 2012 @07:07PM (#4573235)
A lot of console apps dump extra data to stderr, sounds good to me. Especially because if you page the output in less the ads will stay on the screen after you're done :D
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @07:15PM (#4573271)
Well, aside from blowing the signal/noise ratio of stderr out of the water, I suppose it would be fairly entertaining at first to see log files get filled with advertisements.
Re:“grep -R doesn't automatically search amazon” by Newky on Tuesday September 25, 2012 @02:29PM (#4571872)
Not sure whether they should mimic GUI tools, however having tools which provide a graphical user interface, but are fully functional (or at least as much as is possible) from the CLI is the ideal way for a program to be in my opinion.

Where applicable, a command line option can be a great supplement when something that can be achieved via the GUI . For example, encoding a video to a certain codec, having a visual wrapper on this is a nice to have if converting one video or a few videos. However if that same application allows the ability to encode thousands of videos using the CLI option, its an added ability that is appreciated.

Re:“grep -R doesn't automatically search amazon” by phogster on Tuesday September 25, 2012 @02:13PM (#4571783)
No.
Re:“grep -R doesn't automatically search amazon” by peterwwillis on Tuesday September 25, 2012 @02:17PM (#4571808)
Why?
Re:“grep -R doesn't automatically search amazon” by loungin on Tuesday September 25, 2012 @02:23PM (#4571831)
Just throwing out a quick response (I'm not GP) but because they are different interfaces. While they both may display the same content and in the broader overall sense behave similarly, how you interact with the content and program itself is different.
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @03:19PM (#4572152)
Would you expect curl to exhibit the same url suggestion/correction behavior as firefox does?

These tools are only CLI/GUI equivalents of each other in a very superficial sense.

Re:“grep -R doesn't automatically search amazon” by tedunangst on Tuesday September 25, 2012 @03:29PM (#4572197)
No, because the suggestion behavior is a direct function of the UI. I may expect my shell to offer suggestions or autocomplete based on previous history, however. With either program, I expect them to both perform the core task of "download stuff".

Dash and grep may have different interfaces, but if their core purpose is "search stuff", it is not wholly unreasonable to expect them to be able to search the same stuff.

[grep is probably the wrong tool. perhaps the output should be included in find instead.]

Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @03:40PM (#4572259)
> if their core purpose is "search stuff"

As I said, they are the same tool only in the most superficial of senses. Is the purpose of this ubuntu thing even to grep input streams or files? Or did the submitter of this 'bug' actually mean to file a bug for slocate, mlocate, or find? Does it do both? These tools have completely different purposes and uses.

How about this for another reason though: http://pubs.opengroup.org/onlinepubs/009695399/utilities/gre... GNU is bad enough, having Ubuntu tack on whatever shit they feel is "user friendly" would turn the situation into a usability nightmare.

PS. Is this thing seriously called dash? If so, that is terrible. The name 'dash' is already taken... in the FOSS world... by Ubuntu's daddy distro Debian. Hell, Googling "ubuntu dash" returns first results for the proper dash. What the hell were they thinking?

Re:“grep -R doesn't automatically search amazon” by peterwwillis on Wednesday September 26, 2012 @10:14AM (#4575714)
Two things:

1. Why on earth wouldn't you want url suggestion/completion for cURL? If there's one place that benefits from a lack of typing it's command-line tools (which is why modern shells all have command and file tab completion).

2. Browsers like 'links' and 'w3m' go so far as to implement mouse support so you can emulate a GUI on the console. Why not for cURL? Just because it has a billion obscure command-line arguments doesn't mean it's a great idea to keep it that way. With a console ncurses UI for cURL I could pick all the options I wanted quickly instead of paging through dozens of man page options, then copying them down with the argument I wanted and re-typing them in line.

I don't think shells should suffer from a lack of innovation just because everyone's obsessed with JavaScript.

Re:“grep -R doesn't automatically search amazon” by dredmorbius on Tuesday September 25, 2012 @03:51PM (#4572303)
zsh
Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @04:24PM (#4572467)
...is not a part of curl.

And that is rather the point is it not? If you want to add completion to curl, you don't. Because that is a task for another program. If you want to add amazon searching to grep, you don't. Because that is a task for another program.

Re:“grep -R doesn't automatically search amazon” by dredmorbius on Tuesday September 25, 2012 @06:06PM (#4572939)
My point was that command-line completions are possible, and are, in fact, pretty sophisticated. Despite my using 'zsh' as the meme, I'm much more a bash user myself, but even its commandline completions are extensive, and include the ability to suggest completions, alternatives, and the like. Commands such as ssh will utilize various resources to suggest hostname completions and the like.

Whether and how desirable this is is quite the different question. But it's very technically feasible.

Re:“grep -R doesn't automatically search amazon” by jlgreco on Tuesday September 25, 2012 @06:34PM (#4573077)
I am not saying that it could not be done.

I am saying it should not be done, and cannot be done well.

Re:“grep -R doesn't automatically search amazon” by statictype on Tuesday September 25, 2012 @09:55PM (#4573844)
No.