fix(cli): R6 — i18n para strings literais em logs.mjs e tunnel.mjs

Substitui 13 strings hardcoded em logs.mjs e 2 em tunnel.mjs por chamadas
t() com chaves adicionadas nas locales en.json e pt-BR.json.
This commit is contained in:
diegosouzapw
2026-05-15 09:01:48 -03:00
parent dcc21f1052
commit 2faf3608b2
4 changed files with 30 additions and 16 deletions

View File

@@ -4,19 +4,19 @@ import { t } from "../i18n.mjs";
export function registerLogs(program) {
program
.command("logs")
.description("Stream request logs")
.option("--follow", "Stream logs in real-time")
.option("--filter <level>", "Filter by level (error,warn,info) — comma-separated")
.option("--lines <n>", "Number of lines to fetch", "100")
.option("--timeout <ms>", "Connection timeout in ms", "30000")
.option("--base-url <url>", "OmniRoute API base URL", "http://localhost:20128")
.option("--request-id <id>", "Filter by request ID")
.option("--api-key <key>", "Filter by API key")
.option("--combo <name>", "Filter by combo name")
.option("--status <code>", "Filter by HTTP status code")
.option("--duration-min <ms>", "Min request duration in ms", parseInt)
.option("--duration-max <ms>", "Max request duration in ms", parseInt)
.option("--export <path>", "Save logs to file (json/jsonl/csv)")
.description(t("logs.description"))
.option("--follow", t("logs.follow"))
.option("--filter <level>", t("logs.filter"))
.option("--lines <n>", t("logs.lines"), "100")
.option("--timeout <ms>", t("logs.timeout"), "30000")
.option("--base-url <url>", t("logs.baseUrl"), "http://localhost:20128")
.option("--request-id <id>", t("logs.requestId"))
.option("--api-key <key>", t("logs.apiKey"))
.option("--combo <name>", t("logs.combo"))
.option("--status <code>", t("logs.status"))
.option("--duration-min <ms>", t("logs.durationMin"), parseInt)
.option("--duration-max <ms>", t("logs.durationMax"), parseInt)
.option("--export <path>", t("logs.export"))
.action(async (opts, cmd) => {
const globalOpts = cmd.optsWithGlobals();
const exitCode = await runLogsCommand({ ...opts, output: globalOpts.output });

View File

@@ -9,8 +9,8 @@ export function registerTunnel(program) {
tunnel
.command("list")
.description("List active tunnels")
.option("--json", "Output as JSON")
.description(t("tunnel.listDescription"))
.option("--json", t("common.jsonOpt"))
.action(async (opts, cmd) => {
const globalOpts = cmd.parent.optsWithGlobals();
const exitCode = await runTunnelListCommand({ ...opts, output: globalOpts.output });
@@ -19,7 +19,7 @@ export function registerTunnel(program) {
tunnel
.command("create [type]")
.description("Create a tunnel")
.description(t("tunnel.createDescription"))
.addArgument(
new Argument("[type]", "Tunnel type").choices(VALID_TUNNEL_TYPES).default("cloudflare")
)

View File

@@ -433,6 +433,8 @@
},
"tunnel": {
"title": "Tunnels",
"listDescription": "List active tunnels",
"createDescription": "Create a tunnel",
"created": "Tunnel created: {url}",
"stopped": "Tunnel stopped.",
"confirmStop": "Stop tunnel {id}?",
@@ -1161,6 +1163,11 @@
},
"logs": {
"description": "Stream or export request logs",
"follow": "Stream logs in real-time",
"filter": "Filter by level (error,warn,info) — comma-separated",
"lines": "Number of lines to fetch",
"timeout": "Connection timeout in ms",
"baseUrl": "OmniRoute API base URL",
"requestId": "Filter by request ID",
"apiKey": "Filter by API key",
"combo": "Filter by combo name",

View File

@@ -433,6 +433,8 @@
},
"tunnel": {
"title": "Túneis",
"listDescription": "Listar túneis ativos",
"createDescription": "Criar um túnel",
"created": "Túnel criado: {url}",
"stopped": "Túnel parado.",
"confirmStop": "Parar túnel {id}?",
@@ -1161,6 +1163,11 @@
},
"logs": {
"description": "Streaming ou exportação de logs de request",
"follow": "Transmitir logs em tempo real",
"filter": "Filtrar por nível (error,warn,info) — separados por vírgula",
"lines": "Número de linhas a buscar",
"timeout": "Timeout de conexão em ms",
"baseUrl": "URL base da API do OmniRoute",
"requestId": "Filtrar por ID do request",
"apiKey": "Filtrar por chave de API",
"combo": "Filtrar por nome do combo",