[arch-projects] [INITSCRIPTS][PATCH 4/4] rc.d: list [started|stopped|auto|noauto|daemon]

Lukas Fleischer archlinux at cryptocrack.de
Tue Aug 23 06:57:50 EDT 2011


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 at 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>...`,
even. This would allow for something like `rc.d list --started --auto
sshd gpm` (list all running daemons that are started automatically and
limit output to sshd and gpm).

Not sure if there's any use case for such complicated combinations but
it is just as easy to implement and makes everything consistent.

> 
> (or whatever the syntax is for an arbitrary list of daemons).
> 
> Cheers,
> 
> Tom


More information about the arch-projects mailing list