models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package models defines data structures used throughout ccmd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Source       string            `json:"source"`
	InstalledAt  time.Time         `json:"installed_at"`
	UpdatedAt    time.Time         `json:"updated_at"`
	Dependencies []string          `json:"dependencies,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

Command represents an installed command in the lock file

func (*Command) Validate

func (c *Command) Validate() error

Validate validates a single command entry

type CommandMetadata

type CommandMetadata struct {
	Name        string   `yaml:"name" json:"name"`
	Version     string   `yaml:"version" json:"version"`
	Description string   `yaml:"description" json:"description"`
	Author      string   `yaml:"author" json:"author"`
	Repository  string   `yaml:"repository" json:"repository"`
	Entry       string   `yaml:"entry,omitempty" json:"entry,omitempty"`
	Tags        []string `yaml:"tags,omitempty" json:"tags,omitempty"`
	License     string   `yaml:"license,omitempty" json:"license,omitempty"`
	Homepage    string   `yaml:"homepage,omitempty" json:"homepage,omitempty"`
}

CommandMetadata represents the structure of a ccmd.yaml file

func (*CommandMetadata) MarshalJSON

func (cm *CommandMetadata) MarshalJSON() ([]byte, error)

MarshalJSON marshals CommandMetadata to JSON

func (*CommandMetadata) MarshalYAML

func (cm *CommandMetadata) MarshalYAML() ([]byte, error)

MarshalYAML marshals CommandMetadata to YAML

func (*CommandMetadata) UnmarshalJSON

func (cm *CommandMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON data into CommandMetadata

func (*CommandMetadata) UnmarshalYAML

func (cm *CommandMetadata) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals YAML data into CommandMetadata

func (*CommandMetadata) Validate

func (cm *CommandMetadata) Validate() error

Validate validates the command metadata

type LockFile

type LockFile struct {
	Version  string              `json:"version"`
	Commands map[string]*Command `json:"commands"`
}

LockFile represents the commands.lock file structure

func (*LockFile) GetCommand

func (lf *LockFile) GetCommand(name string) (*Command, bool)

GetCommand returns a command entry by name

func (*LockFile) RemoveCommand

func (lf *LockFile) RemoveCommand(name string)

RemoveCommand removes a command from the lock file

func (*LockFile) SetCommand

func (lf *LockFile) SetCommand(name string, cmd *Command)

SetCommand sets or updates a command entry

func (*LockFile) ToJSON

func (lf *LockFile) ToJSON() ([]byte, error)

ToJSON marshals the lock file to JSON bytes

func (*LockFile) Validate

func (lf *LockFile) Validate() error

Validate validates the lock file structure

Jump to

Keyboard shortcuts

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