utils

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidBasecampColors = []string{
	"white", "red", "orange", "yellow", "green", "blue", "aqua", "purple", "gray", "pink", "brown",
}

ValidBasecampColors contains all colors supported by the Basecamp API Reference: https://github.com/basecamp/bc3-api

Functions

func AtomicRename added in v0.15.2

func AtomicRename(src, dst string) error

AtomicRename renames src to dst atomically where possible. On POSIX systems os.Rename replaces an existing dst atomically. On Windows os.Rename fails when dst already exists, so we remove the destination first and then rename. This leaves a small window where dst doesn't exist, but it prevents silent failures that would strand the temp file and leave the old config in place.

func FormatCardAsMarkdown added in v0.7.2

func FormatCardAsMarkdown(card *api.Card, comments []api.Comment) (string, error)

FormatCardAsMarkdown formats a card with all its comments as AI-optimized markdown

func FormatCommentsForDisplay added in v0.7.2

func FormatCommentsForDisplay(comments []api.Comment) (string, error)

FormatCommentsForDisplay formats a list of comments for display in a pager

func FormatDocumentAsMarkdown added in v0.7.2

func FormatDocumentAsMarkdown(document *api.Document, comments []api.Comment) (string, error)

FormatDocumentAsMarkdown formats a document with all its comments as AI-optimized markdown

func FormatMessageAsMarkdown added in v0.7.2

func FormatMessageAsMarkdown(message *api.Message, comments []api.Comment) (string, error)

FormatMessageAsMarkdown formats a message with all its comments as AI-optimized markdown

func FormatTodoAsMarkdown added in v0.7.2

func FormatTodoAsMarkdown(todo *api.Todo, comments []api.Comment) (string, error)

FormatTodoAsMarkdown formats a todo with all its comments as AI-optimized markdown

func ShowInPager

func ShowInPager(content string, opts *PagerOptions) error

ShowInPager displays content using the configured pager

func SortProjectsByName

func SortProjectsByName(projects []api.Project)

SortProjectsByName sorts a slice of projects alphabetically by name (case-insensitive)

func ValidateColor added in v0.11.3

func ValidateColor(color string) (string, error)

ValidateColor checks if the provided color is valid for Basecamp resources It performs case-insensitive comparison and returns the lowercase color if valid

func WriteToPager

func WriteToPager(opts *PagerOptions) (io.WriteCloser, error)

WriteToPager creates a writer that will display content through a pager

Types

type PagerOptions

type PagerOptions struct {
	// Pager command to use (e.g., "less", "more")
	Pager string
	// Whether to force pager even if not a TTY
	Force bool
	// Whether to disable pager
	NoPager bool
}

PagerOptions contains options for the pager

type UserResolver

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

UserResolver helps resolve user identifiers to Person objects

func NewUserResolver

func NewUserResolver(client api.APIClient, projectID string) *UserResolver

NewUserResolver creates a new user resolver for a project

func (*UserResolver) GetPeople

func (ur *UserResolver) GetPeople(ctx context.Context) ([]api.Person, error)

GetPeople returns the cached list of people in the project

func (*UserResolver) ResolveUsers

func (ur *UserResolver) ResolveUsers(ctx context.Context, identifiers []string) ([]int64, error)

ResolveUsers resolves a list of user identifiers to person IDs Supports: - Email addresses: john@example.com - @mentions: @john (matches by name, case-insensitive) - Mixed: @john,jane@example.com

Jump to

Keyboard shortcuts

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