[PATCH 2/4] qh: Fall for peer pressure from myself, and implement some help

Andreas Ericsson ae at op5.se
Wed Nov 28 13:23:30 CET 2012


On 11/27/2012 05:41 PM, robin.sonefors at op5.com wrote:
> From: Robin Sonefors <robin.sonefors at op5.com>
> 
> This is still quite sparse, as it's intended as inline help and hints,
> rather than as complete documentation, but it should still prove
> helpful.
> 

I like the general direction, but see comments inline.

> Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
> ---
>   base/nerd.c          |  7 +++++++
>   base/query-handler.c | 15 +++++++++++++++
>   base/workers.c       | 10 ++++++++++
>   3 files changed, 32 insertions(+)
> 
> diff --git a/base/nerd.c b/base/nerd.c
> index 897a5da..05a0953 100644
> --- a/base/nerd.c
> +++ b/base/nerd.c
> @@ -400,6 +400,13 @@ static int nerd_qh_handler(int sd, char *request, unsigned int len)
>   	struct nerd_channel *chan;
>   	int action;
>   
> +	if (!strcmp(request, "--help")) {
> +		nsock_printf_nul(sd, "Manage subscriptions to NERD channels.\n"
> +			"Valid commands are 'subscribe' and 'unsubscribe' to a specified channel.\n"
> +			"Valid channels are 'hostchecks', 'servicechecks' and 'opathchecks'.");
> +		return 0;
> +	}
> +

First off, the nerd channel list must be generated dynamically. We
have them in a handy array, so we might as well print them all
while we're at it. If we make it possible to provide a description
string when creating the channel we can print that too and the help
API for the nerd channel is pretty much complete.

Secondly; Why not just 'help'? That way people can do what's natural
with text interfaces and try "@nerd help" and they would still get the
same response, whereas typing "@nerd --help" into an interactive text
listener seems less intuitive.

Thoughts?

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net




More information about the Developers mailing list