On Tue, Aug 23, 2011 at 12:57:50PM +0200, Lukas Fleischer wrote:
On Tue, Aug 23, 2011 at 12:44:08PM +0200, Tom Gundersen wrote:
On Tue, Aug 23, 2011 at 12:19 PM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
On Tue, Aug 23, 2011 at 11:05:56AM +0200, Sebastien Luttringer wrote:
e.g: $name list - $name list started - $name help + $name list sshd gpm + $name list started #all started daemons + $name list /started #daemon nammed started
Eeeeew. Don't do that.. Please! Three suggestions:
* Just be okay with "started" being ambiguous. There probably won't be any daemon called {started,stopped,auto,noauto} in the next 100 years. This is all about doing it "right". If Tom and you are fine with ambiguity, keep the way you did it in the first submission.
Ambiguity is not ok.
* Do what I suggested in my first reply to the first version of this patch and introduce a separate keyword.
That seems perfectly reasonable.
* Use some separator like "--" to specify that there won't be any further commands. `rc.d list started` will list all started daemons. `rc.d list -- started auto` will list daemons called "started" and "auto".
This was my first thought as well, though I think a separate keyword would be nicer.
... but for the sake of god, please don't use "/" as some weird kind of escape character.
Yeah, that is a bit too non-standard.
I think my preferred solution would be to prefix all keywords with "--". This would also allow you to use keywords in other actions without weirdness ("rc.d start --stopped" would be nice, but "rc.d start daemons sshd"/"rc.d start -- sshd" would be horrible).
Agreed. I thought of GNU-style long options before but didn't propose them since you were using a completely different syntax here. Introducing them sounds like the best idea.
I suggest the grammar to be something along the lines of:
$name list [--started|--stopped|--auto|--noauto|<daemon>...<daemon>]
Maybe `rc.d list [--started|--stopped|--auto|--noauto] <daemon>...`,
`rc.d list [--started|--stopped|--auto|--noauto] [<daemon>...]`, of course. Skipping the optional list of daemons should just list all daemons that are matched by the "--started"/"--stopped"/... filters.