runmode

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package runmode provides execution mode signaling via context. It allows business logic to branch based on whether the application is running as a CLI, API server, or MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMode

func WithMode(ctx context.Context, m Mode) context.Context

WithMode returns a new context with the execution mode attached.

Types

type Mode

type Mode uint8

Mode represents the execution mode of the application.

const (
	// CLI indicates the application is running as a command-line tool.
	CLI Mode = iota + 1
	// API indicates the application is running as an HTTP API server.
	API
)

func FromContext

func FromContext(ctx context.Context) Mode

FromContext retrieves the Mode from the context. Returns CLI as the default if no mode is present.

func (Mode) String

func (m Mode) String() string

String returns the lowercase name of the mode.

Jump to

Keyboard shortcuts

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