---
source: lib/src/sdk/typescript/types.rs
expression: "get_file(&output, \"client.ts\")"
---
// @generated by usage-cli from test.usage.kdl. Do not edit manually.
import { CliRunner, CliResult } from "./runtime";
import { AddRemoteArgs, RemoveRemoteArgs } from "./types";

export class Cli {
  private runner: CliRunner;
  /** Add a remote */
  readonly addRemote: AddRemote;
  /** Remove a remote */
  readonly removeRemote: RemoveRemote;

  constructor(binPath?: string) {
    this.runner = new CliRunner(binPath ?? "cli");
    this.addRemote = new AddRemote(this.runner);
    this.removeRemote = new RemoveRemote(this.runner);
  }
  /** <SUBCOMMAND> */
  async exec(): Promise<CliResult> {
    return this.runner.run([]);
  }
}

/** Add a remote */
export class AddRemote {
  private runner: CliRunner;

  constructor(runner: CliRunner) {
    this.runner = runner;
  }
  /** add-remote <name> <url> */
  async exec(args: AddRemoteArgs): Promise<CliResult> {
    const cmdArgs: string[] = ["add-remote"];
    if (args.name !== undefined) { cmdArgs.push(String(args.name)); }
    if (args.url !== undefined) { cmdArgs.push(String(args.url)); }
    return this.runner.run(cmdArgs);
  }
}

/** Remove a remote */
export class RemoveRemote {
  private runner: CliRunner;

  constructor(runner: CliRunner) {
    this.runner = runner;
  }
  /** remove-remote <name> */
  async exec(args: RemoveRemoteArgs): Promise<CliResult> {
    const cmdArgs: string[] = ["remove-remote"];
    if (args.name !== undefined) { cmdArgs.push(String(args.name)); }
    return this.runner.run(cmdArgs);
  }
}
