[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UPDATE: command: negation



* Tyler Thomas Hart <tylerthomashart _at_ gmail _dot_ com> [2012-11-28 16:28:47 -0800]:
> As requested by Thorsten, here are my patches in plain text and not
> archived.
> 
>        ! COMMANDS
>            "!" executes the provided commands, but inverts their return
> value. If the provided command returns a nonzero, "!" returns a 0, if the
>            command returns a zero, "!" returns a 1.
> 
> (1/3)

You might want to add a completion function so tab completion works.

In command.c inside g_completions[], add a line like:

   { "!",              GE, 1,  .function = complete_against_negation },

Then add a new function to command.c and command.h:

   void complete_against_negation(int argc, char** argv, int position,
                                  GString* output) {
       complete_against_commands(argc - 1, argv + 1, position - 1, output);
   }

Florian
-- 
() ascii ribbon campaign - stop html mail    www.asciiribbon.org
/\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
It is far more impressive when others discover your good qualities without 
your help. -- Miss Manners