cli

package module
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 18 Imported by: 0

README

GitHub Anchor Banner

Introduction

anchor provides a command line interface for the Anchor.dev certificate management platform.

  • Need a secure browser context for development?
  • There's a better option than localhost.
  • Effortlessly get HTTPS in your local development environment. Get set up in two easy commmands.

For more information visit Lcl.host or the Anchor Docs

Installation

macOS

Available via Homebrew or as a downloadable binary from the releases page.

Homebrew

Install:

brew install anchordotdev/tap/anchor

Upgrade:

brew update && brew upgrade anchordotdev/tap/anchor
Linux & BSD

Available via Homebrew or as a downloadable binary from the releases page.

Homebrew

Install:

brew install anchordotdev/tap/anchor

Upgrade:

brew upgrade anchordotdev/tap/anchor
Windows

Available via Chocolatey or as a downloadable binary from the releases page.

Chocolatey

Install:

chocolatey install anchor --version=0.0.22
Install from source

Install:

go install github.com/anchordotdev/cli/cmd/anchor@latest

Setup

  • After installing, run anchor lcl and follow the instructions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdRoot = NewCmd[ShowHelp](nil, "anchor", func(cmd *cobra.Command) {})
View Source
var Version = struct {
	Version, Commit, Date string

	Os, Arch string
}{
	Version: "dev",
	Commit:  "none",
	Date:    "unknown",
	Os:      runtime.GOOS,
	Arch:    runtime.GOARCH,
}

Functions

func Cleanup added in v0.0.26

func Cleanup(returnedError *error, errc chan error, ctx context.Context, drv *ui.Driver, cmd *cobra.Command, args []string)

func Client

func Client(cfg *Config) (http.Client, error)

func ContextWithConfig added in v0.0.21

func ContextWithConfig(ctx context.Context, cfg *Config) context.Context

func IsDevVersion added in v0.0.25

func IsDevVersion() bool

func NewCmd added in v0.0.21

func NewCmd[T UIer](parent *cobra.Command, name string, fn func(*cobra.Command)) *cobra.Command

func NewTestCmd added in v0.0.23

func NewTestCmd(cmd *cobra.Command) *cobra.Command

func ReleaseTagName added in v0.0.25

func ReleaseTagName() string

func ReportError added in v0.0.26

func ReportError(ctx context.Context, drv *ui.Driver, cmd *cobra.Command, args []string, msg any, stack string)

func UserAgent added in v0.0.25

func UserAgent() string

func VersionString added in v0.0.25

func VersionString() string

Types

type CmdDef added in v0.0.21

type CmdDef struct {
	Name string

	Use   string
	Args  cobra.PositionalArgs
	Short string
	Long  string

	SubDefs []CmdDef
}

type Config

type Config struct {
	JSON           bool `desc:"Only print JSON output to STDOUT." flag:"json,j" env:"JSON_OUTPUT" toml:"json-output"`
	NonInteractive bool `desc:"Run without ever asking for user input." flag:"non-interactive,n" env:"NON_INTERACTIVE" toml:"non-interactive"`
	Verbose        bool `desc:"Verbose output." flag:"verbose,v" env:"VERBOSE" toml:"verbose"`

	AnchorURL string `default:"https://anchor.dev" desc:"TODO" flag:"host" env:"ANCHOR_HOST" toml:"anchor-host"`

	API struct {
		URL   string `` /* 128-byte string literal not displayed */
		Token string `desc:"Anchor API personal access token (PAT)." flag:"api-token,t" env:"API_TOKEN" json:"api_token" toml:"token"`
	}

	Lcl struct {
		Service   string `desc:"Name for lcl.host diagnostic service." flag:"service" env:"SERVICE" json:"service" toml:"service"`
		Subdomain string `desc:"Subdomain for lcl.host diagnostic service." flag:"subdomain" env:"SUBDOMAIN" json:"subdomain" toml:"subdomain"`

		DiagnosticAddr string `default:":4433" desc:"Local server address" flag:"addr,a" env:"ADDR" json:"address" toml:"address"`
		LclHostURL     string `default:"https://lcl.host" env:"LCL_HOST_URL"`

		Audit struct {
		} `cmd:"audit"`

		Clean struct {
		} `cmd:"clean"`

		Config struct {
		} `cmd:"config"`

		MkCert struct {
			Domains []string `flag:"domains"`
			SubCa   string   `flag:"subca"`
		} `cmd:"mkcert"`

		Setup struct {
			Language string `desc:"Language to use for integrating Anchor." flag:"language" json:"language" toml:"language"`
		} `cmd:"setup"`
	} `cmd:"lcl"`

	Test struct {
		Browserless bool `desc:"run as though browserless"`
		SkipRunE    bool `desc:"skip RunE for testing purposes"`
	}

	Trust struct {
		Org   string `desc:"organization" flag:"org,o" env:"ORG" json:"org" toml:"org"`
		Realm string `desc:"realm" flag:"realm,r" env:"REALM" json:"realm" toml:"realm"`

		NoSudo bool `desc:"Disable sudo prompts." flag:"no-sudo" env:"NO_SUDO" toml:"no-sudo"`

		MockMode bool `env:"ANCHOR_CLI_TRUSTSTORE_MOCK_MODE"`

		Stores []string `default:"[system,nss,homebrew]" desc:"trust stores" flag:"trust-stores" env:"TRUST_STORES" toml:"trust-stores"`

		Audit struct{} `cmd:"audit"`

		Clean struct {
			States []string `default:"[expired]" desc:"cert state(s)" flag:"cert-states" env:"CERT_STATES" toml:"cert-states"`
		} `cmd:"clean"`
	} `cmd:"trust"`

	User struct {
		Auth struct {
			SignIn struct{} `cmd:"signin"`

			SignOut struct{} `cmd:"signout"`

			WhoAmI struct{} `cmd:"whoami"`
		} `cmd:"auth"`
	} `group:"user,user management" toml:"user"`

	Keyring struct {
		MockMode bool `env:"ANCHOR_CLI_KEYRING_MOCK_MODE"`
	}

	Version struct{} `cmd:"version"`
}

func ConfigFromCmd added in v0.0.21

func ConfigFromCmd(cmd *cobra.Command) *Config

func ConfigFromContext added in v0.0.21

func ConfigFromContext(ctx context.Context) *Config

type ContextKey added in v0.0.21

type ContextKey string

type ShowHelp added in v0.0.21

type ShowHelp struct{}

func (ShowHelp) UI added in v0.0.21

func (c ShowHelp) UI() UI

type UI added in v0.0.8

type UI struct {
	RunTUI func(context.Context, *ui.Driver) error
}

type UIer added in v0.0.21

type UIer interface {
	UI() UI
}

Directories

Path Synopsis
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
cmd
oid
internal
lcl
Package truststore manages local trust stores and certificates.
Package truststore manages local trust stores and certificates.
ui

Jump to

Keyboard shortcuts

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