config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = ".gh-pm.yml"

Variables

This section is empty.

Functions

func Exists

func Exists() bool

Exists checks if configuration file exists

func FindConfigPath

func FindConfigPath() string

FindConfigPath returns the path to the configuration file

Types

type Config

type Config struct {
	Project      ProjectConfig    `yaml:"project"`
	Repositories []string         `yaml:"repositories"`
	Defaults     DefaultsConfig   `yaml:"defaults"`
	Fields       map[string]Field `yaml:"fields"`
	Metadata     *ConfigMetadata  `yaml:"metadata,omitempty"`
}

Config represents the project configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func Load

func Load() (*Config, error)

Load loads configuration from file

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads configuration from file with enhanced error handling

func (*Config) GetFieldMetadata

func (c *Config) GetFieldMetadata(fieldName string) *FieldMetadata

GetFieldMetadata returns metadata for a specific field

func (*Config) GetProjectID

func (c *Config) GetProjectID() string

GetProjectID returns the cached project ID if available

func (*Config) LoadMetadata

func (c *Config) LoadMetadata() (*ConfigMetadata, error)

LoadMetadata loads just the metadata section from configuration

func (*Config) Save

func (c *Config) Save(path string) error

Save saves configuration to file

func (*Config) SaveWithMetadata

func (c *Config) SaveWithMetadata(path string) error

SaveWithMetadata saves configuration with metadata to file

func (*Config) SetProjectID

func (c *Config) SetProjectID(id string)

SetProjectID sets the project ID in metadata

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type ConfigMetadata

type ConfigMetadata struct {
	Project ProjectMetadata `yaml:"project"`
	Fields  FieldsMetadata  `yaml:"fields"`
}

ConfigMetadata represents cached project metadata

type DefaultsConfig

type DefaultsConfig struct {
	Priority string   `yaml:"priority"`
	Status   string   `yaml:"status"`
	Labels   []string `yaml:"labels"`
}

DefaultsConfig represents default values

type Field

type Field struct {
	Field  string            `yaml:"field"`
	Values map[string]string `yaml:"values"`
}

Field represents a custom field mapping

type FieldMetadata

type FieldMetadata struct {
	ID      string            `yaml:"id"`      // Field ID
	Options map[string]string `yaml:"options"` // name -> option ID
}

FieldMetadata represents cached field IDs and options

type FieldsMetadata

type FieldsMetadata struct {
	Status   *FieldMetadata `yaml:"status,omitempty"`
	Priority *FieldMetadata `yaml:"priority,omitempty"`
}

FieldsMetadata represents cached field metadata

type ProjectConfig

type ProjectConfig struct {
	Name   string `yaml:"name"`
	Number int    `yaml:"number,omitempty"`
	Org    string `yaml:"org,omitempty"`
	Owner  string `yaml:"owner,omitempty"` // Project owner username (for URL generation)
}

ProjectConfig represents project settings

type ProjectMetadata

type ProjectMetadata struct {
	ID string `yaml:"id"` // Node ID (e.g., "PVT_kwHOAAlRwM4A8arc")
}

ProjectMetadata represents cached project IDs

Jump to

Keyboard shortcuts

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