buildCommand(command: string,options?: { attributes?: Record<string, string | number | boolean>; queries?: Record<string, string | number | boolean>; }): string[]
Builds a command sentence from structured data
Build a simple command
Build a simple command
import { assertEquals } from "@std/assert"; import { buildCommand } from "@hertzg/routeros-api/protocol/command"; const words = buildCommand("/interface/print"); assertEquals(words, ["/interface/print"]);
Build command with attributes
Build command with attributes
import { assertEquals } from "@std/assert"; import { buildCommand } from "@hertzg/routeros-api/protocol/command"; const words = buildCommand("/interface/set", { attributes: { "name": "ether1-new", "disabled": "yes" } }); assertEquals(words, ["/interface/set", "=name=ether1-new", "=disabled=yes"]);