paru

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package paru implements the dotdrift mise package-plugin backend for the `paru` manager (pacman + AUR). The dotdrift paru subcommand exposes two operations — installed (status check) and install — that the Lua plugin shim delegates to. This keeps all paru invocation logic in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStatus

func FormatStatus(states []State) string

FormatStatus emits the line-based protocol consumed by the Lua plugin shim: one line per package, tab-separated: name<TAB>installed|missing<TAB>version.

func Install

func Install(ctx context.Context, runner Runner, names []string, dryRun, update bool) error

Install runs `paru -S --needed --noconfirm <names>`. paru self-elevates (calls sudo pacman internally); this function invokes no sudo itself.

func InstallArgs

func InstallArgs(names []string, dryRun, update bool) []string

InstallArgs builds the argv for installing packages via paru.

func WritePlugin

func WritePlugin(dir string) error

WritePlugin writes the mise package-plugin for the `paru` manager into dir. Creates the directory and hooks/ subdirectory. Overwrites existing files (the content is deterministic — same call, same bytes).

Types

type ExecRunner

type ExecRunner struct{}

ExecRunner runs commands via exec.CommandContext.

func (ExecRunner) Run

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

Run executes name with args, returning trimmed stdout on success or the combined output on failure (so callers surface the tool's own diagnostics).

type Runner

type Runner interface {
	Run(ctx context.Context, name string, args ...string) (string, error)
}

Runner executes one command and returns its stdout (trimmed) on success or the combined output on failure.

type State

type State struct {
	Name      string
	Installed bool
	Version   string
}

State is one element of the installed-status response.

func PackageStatus

func PackageStatus(ctx context.Context, runner Runner, names []string) []State

PackageStatus checks each package via `pacman -Q <name>`. The query is read-only and never elevates. A package present in pacman's local database (covering both repo and AUR packages) is "installed"; anything else is "missing". Errors from individual queries are tolerated (treated as missing) so one bad name never blocks the batch.

Jump to

Keyboard shortcuts

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