/gh

Module to use GitHub CLI in Deno.

Primary LanguageTypeScriptMIT LicenseMIT

:octocat: gh

Module to use GitHub CLI (aka gh) in Deno. Useful to create extensions using Deno.

Installation

import { gh } from "https://deno.land/x/gh@v0.0.1/mod.ts";

Usage

import { gh } from "https://deno.land/x/gh@v0.0.1/mod.ts";

async function gh(cmd: string, options: Options): Promise<unknown>

Options

interface Options {
  debug?: boolean;
  flags?: Record<string, string | number | boolean | Array<string | number | boolean>>;
  json?: boolean;
}

Example

import { gh } from "./mod.ts";

const repos = await gh("api users/octocat/repos", {
  json: true,
  flags: { paginate: true },
}) as Array<unknown>;

console.log(`@octocat has ${repos.length} repos`);

Permissions

This module requires the --allow-run permission.

Contributing

Please, see CONTRIBUTING.md to learn how you can contribute to this repository.

License

This project is released under the MIT License.