Skip to content

Commit b2f9042

Browse files
authored
fix: exclude logs streaming options from sandbox subcommand help output (#2582)
* fix: exclude logs streaming options from sandbox command help output * fix: update sandbox command help output to exclude `once` option from subcommand
1 parent 5177bc5 commit b2f9042

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

.changeset/rich-walls-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-cli': patch
3+
---
4+
5+
fix: exclude logs streaming options from sandbox command help output

packages/cli/src/commands/sandbox/sandbox_command.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ void describe('sandbox command', () => {
147147
assert.equal(mockHandleProfile.mock.callCount(), 0);
148148
});
149149

150+
void it('dose not show logs streaming options in subcommand help output', async () => {
151+
const output = await commandRunner.runCommand('sandbox secret --help');
152+
assert.match(output, /Manage sandbox secret/);
153+
assert.doesNotMatch(output, /--stream-function-logs/);
154+
assert.doesNotMatch(output, /--logs-filter/);
155+
assert.doesNotMatch(output, /--logs-out-file/);
156+
});
157+
158+
void it('dose not show once option in subcommand help output', async () => {
159+
const output = await commandRunner.runCommand('sandbox secret --help');
160+
assert.match(output, /Manage sandbox secret/);
161+
assert.doesNotMatch(output, /--once/);
162+
});
163+
150164
void it('shows version should not call profile middleware', async () => {
151165
void commandRunner.runCommand('sandbox --version');
152166
assert.equal(mockHandleProfile.mock.callCount(), 0);

packages/cli/src/commands/sandbox/sandbox_command.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ export class SandboxCommand
221221
'Execute a single sandbox deployment without watching for future file changes',
222222
boolean: true,
223223
global: false,
224+
conflicts: [
225+
'exclude',
226+
'dir-to-watch',
227+
'stream-function-logs',
228+
'logs-filter',
229+
'logs-out-file',
230+
],
224231
})
225232
.option('stream-function-logs', {
226233
describe:
@@ -232,6 +239,7 @@ export class SandboxCommand
232239
.option('logs-filter', {
233240
describe: `Regex pattern to filter logs from only matched functions. E.g. to stream logs for a function, specify it's name, and to stream logs from all functions starting with auth specify 'auth' Default: Stream all logs`,
234241
array: true,
242+
global: false,
235243
type: 'string',
236244
group: 'Logs streaming',
237245
implies: ['stream-function-logs'],
@@ -241,6 +249,7 @@ export class SandboxCommand
241249
describe:
242250
'File to append the streaming logs. The file is created if it does not exist. Default: stdout',
243251
array: false,
252+
global: false,
244253
type: 'string',
245254
group: 'Logs streaming',
246255
implies: ['stream-function-logs'],
@@ -262,13 +271,6 @@ export class SandboxCommand
262271
}
263272
return true;
264273
})
265-
.conflicts('once', [
266-
'exclude',
267-
'dir-to-watch',
268-
'stream-function-logs',
269-
'logs-filter',
270-
'logs-out-file',
271-
])
272274
.middleware([this.commandMiddleware.ensureAwsCredentialAndRegion])
273275
);
274276
};

0 commit comments

Comments
 (0)