diff --git a/Sources/CloudCommands/CloudGroup.swift b/Sources/CloudCommands/CloudGroup.swift index 67f31ecb..cf050d2c 100644 --- a/Sources/CloudCommands/CloudGroup.swift +++ b/Sources/CloudCommands/CloudGroup.swift @@ -63,6 +63,7 @@ struct Logs: Command { var options: [CommandOption] = [ .app, .env, + .lines, .showTimestamps, ] @@ -113,7 +114,8 @@ struct LogsRunner: AuthorizedRunner { // pod -- a specific pod // timestamps -- whether to include timestamps let timestamps = self.ctx.flag(.showTimestamps) - let query = "lines=200×tamps=\(timestamps.description)" + let lines = self.ctx.options.value(.lines) ?? "200" + let query = "lines=\(lines)×tamps=\(timestamps.description)" let list = logs.list(query: query) return list.map { list in for log in list { diff --git a/Sources/CloudCommands/CommandOption.swift b/Sources/CloudCommands/CommandOption.swift index 2c093256..199b6ea3 100644 --- a/Sources/CloudCommands/CommandOption.swift +++ b/Sources/CloudCommands/CommandOption.swift @@ -52,6 +52,14 @@ extension CommandOption { "the slug associated with your app." ] ) + + static let lines: CommandOption = .value( + name: "lines", + short: "l", + default: "200", + help: ["if passed, should show timestamps"] + ) + static let showTimestamps: CommandOption = .flag( name: "show-timestamps", short: "t",