Skip to content

Commit e8c02dc

Browse files
committed
fix: add hidden logCacheSize option
1 parent 2142867 commit e8c02dc

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

Diff for: packages/plugin-serverless/src/utils.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const path = require("path");
2-
const camelCase = require("lodash.camelcase");
3-
const { flags } = require("@oclif/command");
1+
const path = require('path');
2+
const camelCase = require('lodash.camelcase');
3+
const { flags } = require('@oclif/command');
44

55
function convertYargsOptionsToOclifFlags(options) {
66
const flagsResult = Object.keys(options).reduce((result, name) => {
@@ -11,16 +11,21 @@ function convertYargsOptionsToOclifFlags(options) {
1111
hidden: opt.hidden,
1212
};
1313

14-
if (typeof opt.default !== "undefined") {
14+
if (typeof opt.default !== 'undefined') {
1515
flag.default = opt.default;
1616

17-
if (opt.type === "boolean") {
17+
if (opt.type === 'boolean') {
1818
if (flag.default === true) {
1919
flag.allowNo = true;
2020
}
2121
}
2222
}
2323

24+
if (opt.type === 'number') {
25+
opt.type = 'string';
26+
flag.parse = input => parseFloat(input);
27+
}
28+
2429
if (opt.alias) {
2530
flag.char = opt.alias;
2631
}
@@ -37,7 +42,7 @@ function convertYargsOptionsToOclifFlags(options) {
3742

3843
function normalizeFlags(flags) {
3944
const result = Object.keys(flags).reduce((current, name) => {
40-
if (name.includes("-")) {
45+
if (name.includes('-')) {
4146
const normalizedName = camelCase(name);
4247
current[normalizedName] = flags[name];
4348
}

Diff for: packages/twilio-run/src/commands/logs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ export const cliInfo: CliInfo = {
112112
describe:
113113
'Path to .env file for environment variables that should be installed',
114114
},
115+
'log-cache-size': {
116+
type: 'number',
117+
hidden: true,
118+
describe:
119+
'Tailing the log endpoint will cache previously seen entries to avoid duplicates. The cache is topped at a maximum of 1000 by default. This option can change that.',
120+
},
115121
},
116122
};
117123

Diff for: packages/twilio-run/src/config/logs.ts

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type LogsCliFlags = Arguments<
3232
functionSid?: string;
3333
tail: boolean;
3434
outputFormat?: string;
35+
logCacheSize?: number;
3536
}
3637
>;
3738

@@ -81,5 +82,6 @@ export async function getConfigFromFlags(
8182
tail: flags.tail,
8283
region,
8384
edge,
85+
logCacheSize: flags.logCacheSize,
8486
};
8587
}

0 commit comments

Comments
 (0)