zsh-users
 help / color / mirror / code / Atom feed
* adding configtest to service httpd options
@ 2016-04-21 16:57 zzapper
  2016-04-22  1:04 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: zzapper @ 2016-04-21 16:57 UTC (permalink / raw)
  To: zsh-users

Hi
Thought I'd just have to add configtest to a list in a function definition 
file _init_d _service etc but no luck


(what I currently get offered Centos 6, zsh 5.2)
force-reload  reload        restart       start         status        stop



-- 
zzapper
https://twitter.com/dailyzshtip

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding configtest to service httpd options
  2016-04-21 16:57 adding configtest to service httpd options zzapper
@ 2016-04-22  1:04 ` Bart Schaefer
  2016-04-22 20:49   ` zzapper
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2016-04-22  1:04 UTC (permalink / raw)
  To: zsh-users

On Apr 21,  4:57pm, zzapper wrote:
}
} Thought I'd just have to add configtest to a list in a function definition 
} file _init_d _service etc but no luck

There are three different versions of the helper function _init_d_get_cmds
in _init_d, so you need to find the correct one for your operating system
and update the pattern that is used for extracting valid action strings
from the individual script files.

Two of the possibilities are for BSD variants so for CentOS the third one
is what you want.  "configtest" appears to be valid only for httpd and
smb, and "graceful" only for httpd, so it's not entirely surprising that
a pattern intended to pick out the common actions from a large set of
script files does not include those special cases.

You need to change the assignment what='(...)' to add configtest to the
alternatives.

There is a more general pattern [that doesn't require a specific set of
words to check] in a comment in _init_d, but as noted there, it may match
things that are not actually valid actions.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding configtest to service httpd options
  2016-04-22  1:04 ` Bart Schaefer
@ 2016-04-22 20:49   ` zzapper
  2016-04-22 22:44     ` Bart Schaefer
       [not found]     ` <160422154422.ZM2884__39944.5106079385$1461365132$gmane$org@torch.brasslantern.com>
  0 siblings, 2 replies; 6+ messages in thread
From: zzapper @ 2016-04-22 20:49 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer <schaefer@brasslantern.com> wrote in
news:160421180453.ZM18158@torch.brasslantern.com: 

> On Apr 21,  4:57pm, zzapper wrote:
> }
> } Thought I'd just have to add configtest to a list in a function
> definition } file _init_d _service etc but no luck
> 

> 
> You need to change the assignment what='(...)' to add configtest to
> the alternatives.
> 
> There is a more general pattern [that doesn't require a specific set
> of words to check] in a comment in _init_d, but as noted there, it may
> match things that are not actually valid actions.
> 
> 
Yep can't get this to work , but not a big priority . Are you implying that 
the completions only allow for standard actions and not optionals like 
configtest which may not be used by all versions of httpd?


-- 
zzapper
https://twitter.com/dailyzshtip

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding configtest to service httpd options
  2016-04-22 20:49   ` zzapper
@ 2016-04-22 22:44     ` Bart Schaefer
  2016-04-23 18:11       ` zzapper
       [not found]     ` <160422154422.ZM2884__39944.5106079385$1461365132$gmane$org@torch.brasslantern.com>
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2016-04-22 22:44 UTC (permalink / raw)
  To: zsh-users

On Apr 22,  8:49pm, zzapper wrote:
} Subject: Re: adding configtest to service httpd options
}
} Bart Schaefer <schaefer@brasslantern.com> wrote in
} news:160421180453.ZM18158@torch.brasslantern.com: 
} 
} > You need to change the assignment what='(...)' to add configtest to
} > the alternatives.
} > 
} Yep can't get this to work , but not a big priority .

Ah.  Hadn't actually looked closely at /etc/init.d/httpd, there is a
bit more to the issue than I thought.

} Are you implying that the completions only allow for standard actions
} and not optionals like configtest which may not be used by all
} versions of httpd?

I'm implying that the completions only allow for the actions that are
supported generically by any/all [or at least most] scripts to be
found in /etc/init.d, and that /etc/init.d/httpd adds several that are
unique.  If you attempt to complete after "service foo", then _init_d
looks for /etc/init.d/foo -- and if it finds it, it scans through that
file looking for "case" branches matching start, stop, status, etc.
It then offers whichever case-branches it finds as the completions.

/etc/init.d/httpd not only has case-branches that _init_d is not even
looking for, it also has case-branches that use syntax that the case-
branch search in _init_d won't match even if looking for the correct
words.  _init_d wants every case to look like " start)" or " stop)"
etc., but http has " graceful|help|configtest|fullstatus)" all in
one combined branch [at least in my copy].  _init_d is unprepared to
deal with that.

This is a situation in which a "good enough" generic completion was
created and special cases are *way* outside of what it covers; there
is no simple correction.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding configtest to service httpd options
  2016-04-22 22:44     ` Bart Schaefer
@ 2016-04-23 18:11       ` zzapper
  0 siblings, 0 replies; 6+ messages in thread
From: zzapper @ 2016-04-23 18:11 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer <schaefer@brasslantern.com> wrote in news:160422154422.ZM2884
@torch.brasslantern.com:

> On Apr 22,  8:49pm, zzapper wrote:
> } Subject: Re: adding configtest to service httpd options
> }
> } Bart Schaefer <schaefer@brasslantern.com> wrote in

> Ah.  Hadn't actually looked closely at /etc/init.d/httpd, there is a
> bit more to the issue than I thought.

Glad to know that I wasn't the only one to find it awkward :)



-- 
zzapper
https://twitter.com/dailyzshtip

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: adding configtest to service httpd options
       [not found]     ` <160422154422.ZM2884__39944.5106079385$1461365132$gmane$org@torch.brasslantern.com>
@ 2016-04-23 21:36       ` Daniel Shahaf
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Shahaf @ 2016-04-23 21:36 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer wrote on Fri, Apr 22, 2016 at 15:44:22 -0700:
> This is a situation in which a "good enough" generic completion was
> created and special cases are *way* outside of what it covers; there
> is no simple correction.

It would have been possible to use the 'fake' style to add the
'cnofigtest' completion if the service name ("httpd") were in the
context; but it is not:

    % service httpd <_complete_help>
    tags in context :completion::complete:service::
        argument-rest  (_arguments _service)

- Perhaps the context should be ...:service-httpd:... ?

- Alternatively, does CentOS provide some kind of help output listing
  the valid commands?  On some OSes, «/etc/init.d/${service}
  invalidargument» does that.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-23 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 16:57 adding configtest to service httpd options zzapper
2016-04-22  1:04 ` Bart Schaefer
2016-04-22 20:49   ` zzapper
2016-04-22 22:44     ` Bart Schaefer
2016-04-23 18:11       ` zzapper
     [not found]     ` <160422154422.ZM2884__39944.5106079385$1461365132$gmane$org@torch.brasslantern.com>
2016-04-23 21:36       ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).