Re: [PATCH v4/wip 01/12] generate-cmds.sh: factor out synopsis extract code

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

 



On Wed, Apr 25, 2018 at 12:30 PM, Nguyễn Thái Ngọc Duy
<pclouds@xxxxxxxxx> wrote:
> This makes it easier to reuse the same code in another place (very
> soon).
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
> @@ -1,5 +1,17 @@
> +get_synopsis () {
> +       local cmd="$1"

'local' is a Bash-ism, isn't it?

> +       sed -n '
> +               /^NAME/,/'"$cmd"'/H
> +               ${
> +                       x
> +                       s/.*'"$cmd"' - \(.*\)/N_("\1")/
> +                       p
> +               }' "Documentation/$cmd.txt"
> +}
> +
>  echo "/* Automatically generated by generate-cmdlist.sh */
>  struct cmdname_help {
>         char name[16];
> @@ -39,12 +51,6 @@ sort |
>  while read cmd tags
>  do
>         tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
> -       sed -n '
> -               /^NAME/,/git-'"$cmd"'/H
> -               ${
> -                       x
> -                       s/.*git-'"$cmd"' - \(.*\)/      {"'"$cmd"'", N_("\1"), '$tag'},/
> -                       p
> -               }' "Documentation/git-$cmd.txt"
> +       echo "  {\"$cmd\", $(get_synopsis git-$cmd), $tag},"
>  done
>  echo "};"




[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