---
source: lib/src/sdk/typescript/types.rs
expression: client
---
// @generated by usage-cli from test.usage.kdl. Do not edit manually.
import { CliRunner, CliResult } from "./runtime";
import { AppFlags } from "./types";

export class App {
  private runner: CliRunner;

  constructor(binPath?: string) {
    this.runner = new CliRunner(binPath ?? "app");
  }
  /** [-v --verbose] */
  async exec(flags?: AppFlags): Promise<CliResult> {
    const cmdArgs: string[] = [];
    const flagArgs = this.buildFlagArgs(flags);
    return this.runner.run([...cmdArgs, ...flagArgs]);
  }

  private buildFlagArgs(flags?: AppFlags): string[] {
    const result: string[] = [];
    if (!flags) return result;
    if (flags.verbose !== undefined && flags.verbose > 0) { for (let i = 0; i < flags.verbose; i++) { result.push("--verbose"); } }
    return result;
  }
}
