Documentation
¶
Index ¶
- func Create(projectName string, hourlyRate float64) error
- func CreateWithTemplate(projectName string, hourlyRate float64, description string, exportPath string) error
- func FormatDate(t time.Time) string
- func FormatDateDashed(t time.Time) string
- func FormatDateLong(t time.Time) string
- func FormatDateTime(t time.Time) string
- func FormatDateTimeDashed(t time.Time) string
- func FormatDateTimeLong(t time.Time) string
- func FormatTime(t time.Time) string
- func FormatTimePadded(t time.Time) string
- func GetDisplayTimezone() *time.Location
- func GetGlobalConfigPath() (string, error)
- func GetProjectsPath() (string, error)
- type Config
- type GlobalConfig
- type GlobalProject
- type ProjectsRegistry
- func (pr *ProjectsRegistry) AddProject(project GlobalProject) error
- func (pr *ProjectsRegistry) DeleteProject(name string) error
- func (pr *ProjectsRegistry) Exists(name string) bool
- func (pr *ProjectsRegistry) GetProject(name string) (*GlobalProject, error)
- func (pr *ProjectsRegistry) ListProjects() []GlobalProject
- func (pr *ProjectsRegistry) Save() error
- func (pr *ProjectsRegistry) UpdateProject(name string, updatedProject GlobalProject) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateWithTemplate ¶
func FormatDate ¶
func FormatDateDashed ¶
func FormatDateLong ¶
func FormatDateTime ¶
func FormatDateTimeDashed ¶
func FormatDateTimeLong ¶
func FormatTime ¶
func FormatTimePadded ¶
func GetDisplayTimezone ¶ added in v0.4.5
GetDisplayTimezone returns the user's configured timezone or local timezone as fallback
func GetGlobalConfigPath ¶
func GetProjectsPath ¶ added in v0.5.0
GetProjectsPath returns the path to the global projects registry file
Types ¶
type Config ¶
type Config struct {
ProjectName string `yaml:"project_name"`
HourlyRate float64 `yaml:"hourly_rate,omitempty"`
Description string `yaml:"description,omitempty"`
ExportPath string `yaml:"export_path,omitempty"`
}
IMPORTANT: When adding new fields to this struct, also update configTemplate below.
func FindAndLoad ¶
type GlobalConfig ¶
type GlobalConfig struct {
Currency string `yaml:"currency"`
DateFormat string `yaml:"date_format,omitempty"`
TimeFormat string `yaml:"time_format,omitempty"`
Timezone string `yaml:"timezone,omitempty"`
ExportPath string `yaml:"export_path,omitempty"`
}
func DefaultGlobalConfig ¶
func DefaultGlobalConfig() *GlobalConfig
func LoadGlobalConfig ¶
func LoadGlobalConfig() (*GlobalConfig, error)
func (*GlobalConfig) Save ¶
func (gc *GlobalConfig) Save() error
type GlobalProject ¶ added in v0.5.0
type GlobalProject struct {
Name string `yaml:"name"`
HourlyRate *float64 `yaml:"hourly_rate,omitempty"`
Description string `yaml:"description,omitempty"`
ExportPath string `yaml:"export_path,omitempty"`
}
GlobalProject represents a global project configuration
type ProjectsRegistry ¶ added in v0.5.0
type ProjectsRegistry struct {
Projects []GlobalProject `yaml:"projects"`
}
ProjectsRegistry holds all global projects
func LoadProjects ¶ added in v0.5.0
func LoadProjects() (*ProjectsRegistry, error)
LoadProjects loads the global projects registry
func (*ProjectsRegistry) AddProject ¶ added in v0.5.0
func (pr *ProjectsRegistry) AddProject(project GlobalProject) error
AddProject adds a new project to the registry
func (*ProjectsRegistry) DeleteProject ¶ added in v0.5.0
func (pr *ProjectsRegistry) DeleteProject(name string) error
DeleteProject removes a project from the registry
func (*ProjectsRegistry) Exists ¶ added in v0.5.0
func (pr *ProjectsRegistry) Exists(name string) bool
Exists checks if a project exists in the registry (case-insensitive)
func (*ProjectsRegistry) GetProject ¶ added in v0.5.0
func (pr *ProjectsRegistry) GetProject(name string) (*GlobalProject, error)
GetProject retrieves a project by name
func (*ProjectsRegistry) ListProjects ¶ added in v0.5.0
func (pr *ProjectsRegistry) ListProjects() []GlobalProject
ListProjects returns all projects in the registry
func (*ProjectsRegistry) Save ¶ added in v0.5.0
func (pr *ProjectsRegistry) Save() error
Save saves the projects registry to disk
func (*ProjectsRegistry) UpdateProject ¶ added in v0.5.0
func (pr *ProjectsRegistry) UpdateProject(name string, updatedProject GlobalProject) error
UpdateProject updates an existing project in the registry