core

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package core provides fundamental command parsing and session management for Better-Curl-Saul. This package handles command line argument parsing, session state management, and system command delegation following Unix philosophy principles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelegateToSystem

func DelegateToSystem(command string, args []string) error

DelegateToSystem executes a system command in the presets directory

func IsSystemCommand

func IsSystemCommand(command string) bool

IsSystemCommand checks if a command is in the allowed system commands whitelist

Types

type Command

type Command struct {
	// Core command parsing
	Global        string
	Preset        string
	Command       string
	Target        string
	Targets       []string // For bulk operations (space-separated args)
	ValueType     string
	Mode          string
	KeyValuePairs []KeyValuePair

	// Flags
	RawOutput      bool     // For --raw flag
	VariableFlags  []string // -v var1 var2 var3 (space-separated variables to prompt)
	ResponseFormat string   // --headers-only, --body-only, --status-only
	DryRun         bool     // --dry-run
	Call           bool     // --call
}

func ParseCommand

func ParseCommand(args []string) (Command, error)

type CurlRequest added in v0.3.0

type CurlRequest struct {
	Method  string
	URL     string
	BaseURL string
	Query   map[string]string
	Headers map[string]string
	Body    string
}

func ParseCurl added in v0.3.0

func ParseCurl(curlCmd string) (*CurlRequest, error)

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

type SessionManager

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

SessionManager encapsulates session state and file operations

func NewSessionManager

func NewSessionManager() (*SessionManager, error)

NewSessionManager creates a new session manager with TTY-based session isolation

func (*SessionManager) GetCurrentPreset

func (s *SessionManager) GetCurrentPreset() string

GetCurrentPreset returns the current preset for this session

func (*SessionManager) HasCurrentPreset

func (s *SessionManager) HasCurrentPreset() bool

HasCurrentPreset returns true if a current preset is set

func (*SessionManager) LoadSession

func (s *SessionManager) LoadSession() error

LoadSession loads the session from the TTY-specific session file

func (*SessionManager) SaveSession

func (s *SessionManager) SaveSession() error

SaveSession saves the current session to the TTY-specific session file

func (*SessionManager) SetCurrentPreset

func (s *SessionManager) SetCurrentPreset(preset string) error

SetCurrentPreset sets the current preset and saves the session

Jump to

Keyboard shortcuts

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