glabcli

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package glabcli provides access to the local GitLab CLI (glab) for authentication and lightweight command execution — the GitLab counterpart of ghcli, standing in for a signed-in person on a single-user server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, args ...string) (string, error)

Run executes `glab` with the given arguments and returns its stdout. The glab binary name is fixed and arguments are supplied by aeman itself, never by untrusted input.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI resolves a GitLab token and the signed-in login from the local glab CLI for one GitLab instance, caching both. Unlike gh, glab keeps a credential per host, so the host is part of every question asked of it.

func New

func New(host string) *CLI

New returns a CLI for the GitLab instance at host ("gitlab.com" when empty), backed by `glab config get token` and `glab api user`.

func (*CLI) Login

func (c *CLI) Login(ctx context.Context) (string, error)

Login returns the username glab is signed in as on the host, cached for the lifetime of the CLI value (it is read on every API request in local mode, and the glab identity does not change under a running server). The host is passed explicitly: `glab api` would otherwise default to gitlab.com or to the instance of the current git directory, which need not be the board's.

func (*CLI) Token

func (c *CLI) Token(ctx context.Context) (string, error)

Token returns a cached GitLab token for the host, fetching a fresh one when the cache has expired. It returns an error if glab is missing or no token is stored for the host.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL