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

Re: UPDATE: command: negation



Florian,

Thanks, I completely overlooked that!
I've implimented command completion using the check-and-shift method from complete_chain. I've also changed the name of the function from invert_return to invert_return_command, since it seems like the syntax all the other commands use.

The patches for negation with command completion are attached. Should I be squashing my commits?

Thanks
Tylo

On Thu, Nov 29, 2012 at 4:17 AM, Florian Bruhin <me _at_ the _minus_ compiler _dot_ org> wrote:
* 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

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
VERIFY Test and improve your parallel project with help from experts
and peers. http://goparallel.sourceforge.net

Attachment: 0001-Added-command-negation.patch
Description: Binary data

Attachment: 0002-Added-command-completion-and-change-some-compliant-s.patch
Description: Binary data

Attachment: 0003-Fixed-command-completion.patch
Description: Binary data