Re: [PATCH v4] [GSOC]trailer: pass arg as positional parameter

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

 



ZheNing Hu <adlternative@xxxxxxxxx> writes:

>> The way to do the same without an extra script on disk is for you to
>> use sh-c yourself.
>>
>>     .cmd = sh -c 'echo 123'
>
> This is indeed a viable solution, But the extra "sh -c" seems to put an
> unnecessary burden on the user.

Nobody forces you to write long script in the configuration file.
In fact, the "find author from history" is so useful that I'd think
people have an alias or a script in ~/bin/ already for their own
interactive use.  E.g.

    $ cat ~/bin/git-who
    #!/bin/sh
    git log -1 --format="%an <%ae>" --author="$1"
    $ cat ~/bin/git-one
    #!/bin/sh
    git show -s --pretty=reference "$1"

and with them:

	trailer.key.cmd = git who

that is internally wrapped into 

	sh -c 'git who "$@"'

and fed "gitster@" as the first parameter when "--trailer=key:gitster@"
is given would work just fine.

> Sometimes I wonder, why not recommend using environment variables
> like $ARG?

I am also fine with that; when we discovered the design flaw of
.command, I think I suggested either would make a viable choice.
The only downside is that it would squat on a good name $ARG and
forbids end-users from using the symbol for other purpose, but as
long as the application is limited in scope, that would be fine.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux