SA Bugzilla – Bug 1646
sa-learn "--single" option should be "--stdin" or similar
Last modified: 2003-06-18 22:06:25 UTC
This option name is confusing. It strikes me that it would be better to change --file to --single and add a --stdin option that redirects *either* --mbox or --single to be on stdin instead of a file on the command line. --file can remain an alias for --single or we can deprecate it (deprecation might be better). I'd like to get this fixed in 2.51 since the --single option is new since 2.50.
Rather than having --stdin, let's just support "-" in std UNIX style. But I think --single is worth keeping for backwards compat, even though it's so new, since we suggest using it in .muttrc's etc.
Maybe I'm mising something obvious here, but why does it need to be an option, at all? If I do "sa-learn --spam", it simply says "Learned from 0 messages." What's worse, if I do "sa-learn --spam < foo", it still says "Learned from 0 messages," even though it might not be unreasonable to assume that what just happened is that sa-learn had already seen the message in question. Thinking about this a lot more, here's what makes a lot of sense to me, because Dan is right that there's basically not any way to do "sa-learn --spam --mbox < foo": Make sa-learn's basic invocation look like: sa-learn [options] [file1..fileN] --mbox becomes an option, stating that the data is in mbox format. If not specified, the input source is presumed to be seperate RFC822 messages. --file becomes ignored for backwards compatability --single becomes ignored for backwards compatability --directory becomes ignored for backwards compatability If no files are specified, sa-learn awaits input on stdin. If one or more files are specified, sa-learn reads them as individual messages (or mboxes if --mbox is present). If one or more directories are specified, sa-learn reads them as directories. Conceivably, this means you could say "sa-learn --spam --mbox spam/" to learn a directory of mboxes. This proposal would cause sa-learn to work much more like other Unix programs, and be more intuitive to most users. If folks think this is a good idea, I'd be happy to try out a patch, but it sounds substantial enough that if folks think this is a bad idea (or want to do it themselves ;) I'll hold off. I'd also presume that a patch this big would go against Dan's desire to get this done for 2.51.
Created attachment 798 [details] Patch to implement my proposal
I realize this was never actually accepted beyond "NEW" but it seemed like an easy way to get my feet wet with the source. Dunno if everyone thinks my proposal is worthless, but here's a patch that implements it in case anyone likes it.
I'll look at this patch.
Subject: Re: [SAdev] sa-learn "--single" option should be "--stdin" or similar BTW, I never commented on this, sorry. ;) FWIW, it looks like a good UI to me...
Dan, still loking at it? Looks good to me, FWIW.
it looks good to me too. quinlan, any updates?
since 3 devs have said ok, I'm going to apply this to 2.60.
committed.
Small enhancement suggestion - debug output should clarify that use_bayes is off. Why? I ran sa-learn as a test of 2.6CVS, and got that it was LEARNING...(listed 500 lines, without tokens). It then said learned from 0 messages. This was a config mistake on my part - left use_bayes 0 in local.cf ... but it wouldn't hurt to SAY so in the -D output!
the suggestion is not related to this bug. please open a new bug with the request.