From 1ebb922e840f77a9f14436ec191ff815c26e3f44 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 4 Mar 2026 12:57:36 +0100 Subject: [PATCH] util: add commentNoInfix support to getInputList Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- __tests__/util.test.ts | 6 ++++++ src/util.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/__tests__/util.test.ts b/__tests__/util.test.ts index 46baaf7..18c3f62 100644 --- a/__tests__/util.test.ts +++ b/__tests__/util.test.ts @@ -87,6 +87,12 @@ describe('getInputList', () => { expect(res).toEqual(['foo=bar', 'bar=qux']); }); + it('multiline with comment and no infix comment', async () => { + setInput('labels', '# ignore this\nfoo=bar\nbar=qux#baz'); + const res = Util.getInputList('labels', {comment: '#', commentNoInfix: true}); + expect(res).toEqual(['foo=bar', 'bar=qux#baz']); + }); + it('different new lines and ignoring comma correctly', async () => { setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir'); const res = Util.getInputList('cache-from', {ignoreComma: true}); diff --git a/src/util.ts b/src/util.ts index d484a6d..c35e882 100644 --- a/src/util.ts +++ b/src/util.ts @@ -24,6 +24,7 @@ import {parse} from 'csv-parse/sync'; export interface ListOpts { ignoreComma?: boolean; comment?: string; + commentNoInfix?: boolean; quote?: string | boolean | Buffer | null; } @@ -42,6 +43,7 @@ export class Util { columns: false, relaxQuotes: true, comment: opts?.comment, + comment_no_infix: opts?.commentNoInfix, relaxColumnCount: true, skipEmptyLines: true, quote: opts?.quote