clihelp

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package clihelp is a small helper used by the cmd/perms, cmd/roles, and cmd/abilities seeding CLIs to dial Postgres, build an *authkit.Auth, and share argument-parsing scaffolding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSNFlag

func DSNFlag(name string) (*flag.FlagSet, *string)

DSNFlag returns a flag.FlagSet pre-populated with --dsn. Callers add their own flags and call Parse on it.

func Dial

func Dial(ctx context.Context, dsn string) (*authkit.Auth, *sql.DB, error)

Dial opens a database connection using either the supplied DSN or the AUTHKIT_DATABASE_URL env var, then constructs an *authkit.Auth ready to run seed operations. Migrations and schema verification both run as part of New.

The CLIs never sign JWTs or hash passwords, but Auth.New requires a JWT secret and a hasher — we supply a dummy secret and the default Argon2id hasher so the constructor passes.

func Fail

func Fail(err error)

Fail prints err to stderr and exits with status 1. Used by every CLI's top-level dispatch.

Types

This section is empty.

Jump to

Keyboard shortcuts

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