Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified and unified argument collection #430

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
npm run format
Signed-off-by: Phred <fearphage@gmail.com>
  • Loading branch information
fearphage committed Nov 17, 2021
commit 9720455de9087c19821b090890ffe06317a7d06e
2 changes: 1 addition & 1 deletion __tests__/context.test.ts
Original file line number Diff line number Diff line change
@@ -644,7 +644,7 @@ describe('flagMap', () => {
expect(results).toEqual([
['--catpants', 'a'],
['--catpants', 'b'],
['--catpants', 'c'],
['--catpants', 'c']
]);
});
});
9 changes: 2 additions & 7 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -88,12 +88,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
}

export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
return [
'buildx',
...await getBuildArgs(inputs, defaultContext, buildxVersion),
...await getCommonArgs(inputs),
inputs.context,
];
return ['buildx', ...(await getBuildArgs(inputs, defaultContext, buildxVersion)), ...(await getCommonArgs(inputs)), inputs.context];
}

async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
@@ -104,7 +99,7 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
...flagMap(inputs.labels, '--label'),
...flagMap(inputs.outputs, '--output'),
...flagMap(inputs.tags, '--tag'),
...flagMap(inputs.ssh, '--ssh'),
...flagMap(inputs.ssh, '--ssh')
);

if (inputs.target) {