git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/1] config: learn the --stdin option for instructions

From
Christian Couder <christian.couder@gmail.com>
Date
Jan 27, 2020, 11:44 UTC
Message-ID
<CAP8UFD1S9yE_SkxJbLWz=HHasYmJnDsR9MuefBsLkdWaYFdu-Q@mail.gmail.com>
In-Reply-To
<20200127100933.10765-2-git@zjvandeweg.nl>
On Mon, Jan 27, 2020 at 11:21 AM Zeger-Jan van de Weg <git@zjvandeweg.nl> wrote:
Show 12 quoted lines
> +static void update_config_stdin()
> +{
> +       struct strbuf input = STRBUF_INIT;
> +       const char *next;
> +       const char *max_char;
> +
> +       if (strbuf_read(&input, 0, 1000) < 0)
> +               die_errno(_("could not read from stdin"));
> +       next = input.buf;
> +
> +       max_char = input.buf + input.len;
> +       while(next < max_char) {
Nit: space missing between "while" and "(".
Show 14 quoted lines
> +               if (*next == term)
> +                       die(_("empty command in input"));
> +               else if (isspace(*next))
> +                       die(_("whitespace before command"));
> +               else if (skip_prefix(next, "set ", &next))
> +                       next = parse_cmd_set(next, max_char);
> +               else if (skip_prefix(next, "unset ", &next))
> +                       next = parse_cmd_unset(next, max_char);
> +               else
> +                       die(_("unknown command %s"), next);
> +       }
> +
> +       strbuf_release(&input);
> +}

Thanks, Christian.

Previous: Zeger-Jan van de WegNext: Eric Sunshine
Message 3 of 9 in “config: read instructions from stdin”
  1. 0/1 config: read instructions from stdinZeger-Jan van de Weg, Jan 27, 2020
  2. 1/1 config: learn the --stdin option for instructionsZeger-Jan van de Weg, Jan 27, 2020
  3. Christian CouderJan 27, 2020
  4. Eric SunshineJan 27, 2020
  5. Jeff KingJan 28, 2020
  6. Eric SunshineJan 28, 2020
  7. Junio C HamanoJan 28, 2020
  8. Jeff KingJan 29, 2020
  9. Jeff KingJan 28, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.