Re: [chrony-users] [patch] adds tab-completion to chronyc

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


On Dec 8, 2016, at 12:36 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:

> On Wed, Dec 07, 2016 at 03:33:37PM -0600, Lonnie Abelbeck wrote:
>> Hi Miroslav,
>> 
>> Attached is a patch I created (against chrony 2.4.1) to add tab-completion to chronyc.  A relatively simple addition.
>> 
>> Also here: https://sourceforge.net/p/astlinux/code/8023/tree//branches/1.0/package/chrony/chrony-0100-chronyc-tab-completion.patch
>> 
>> Works quite well in my testing, using either libedit 20160903-3.1 or readline 7.0 .  All cross-compiled from source.
> 
> Thanks, Lonnie. This is useful. Would it be possible to parse the list
> of commands from the usage text instead of maintaining a separate
> list? The chronyc support in bash-completition works like that.

I presume you meant the "help" output ... Yes, I briefly looked at that, probably more code would be required than the data size of command_names[], and the command_names[] entries can be tweaked specifically for tab-completion.

My thought is to keep things simple (as this patch does) and have a separate tab-completion list.

Possibly, down the road. give_help() text, process_line() parsing matches, and tab-completion text could all be in one structure, but probably not worth stirring-the-code over.


> However, there are some recommendations for submitting patches. They
> should go to the chrony-dev list and they should be git patches
> against HEAD. I'd at least need an email address to which I can set
> the author field in git.

Attached is a git patch against HEAD.

Next time I will use the chrony-dev list. :-)


Lonnie


Attachment: 0001-add-tab-completion-to-chronyc-with-libedit-readline.patch
Description: Binary data




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/