Documentation
¶
Index ¶
- Variables
- func AddAccountIDs(params url.Values, accountIDs string)
- func AddCSVParam(params url.Values, key, csv string)
- func ConfirmPrompt(r io.Reader, w io.Writer, prompt string) (bool, error)
- func FilterChats(chats []api.Chat, unreadOnly, mutedOnly, pinnedOnly, archivedOnly bool, ...) []api.Chat
- func FilterUnreadMessages(messages []api.Message, unreadOnly bool) []api.Message
- func FormatMessageLine(m api.Message, otherName string) string
- func FormatTime(t time.Time) string
- func IsReservedKeyword(input string) bool
- func LimitReplyDepth(messages []api.Message, maxDepth int) []api.Message
- func LimitSlice[T any](items []T, limit int) []T
- func LooksLikeChatID(s string) bool
- func MessageDisplayText(m api.Message) string
- func MessageSender(m api.Message) string
- func MessageSenderDisplay(m api.Message, otherName string) string
- func MinInt(a, b int) int
- func NewestSortKey(messages []api.Message) string
- func NormalizeDateAfter(value string) string
- func OffsetSlice[T any](items []T, offset int) []T
- func OldestSortKey(messages []api.Message) string
- func OtherChatName(chat api.Chat) string
- func PaginateSlice[T any](items []T, offset, limit int) []T
- func ParseRelativeTime(s string, now time.Time) (time.Time, error)
- func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, ...) error
- func PrintMessageLine(w io.Writer, m api.Message, otherName string)
- func ReadFile(path string) (string, error)
- func ReadStdin(r io.Reader) (string, error)
- func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, ...) (string, error)
- func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, ...) (string, error)
- func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, ...) (string, error)
- func ResolveChatIdentifier(input string, aliases map[string]string, noteToSelfID string) (string, error)
- func ResolveMessageInput(text string, stdin bool, file string, in io.Reader) (string, error)
- func SenderName(senderID string) string
- func SortMessagesByTime(messages []api.Message) []api.Message
- func TailSlice[T any](items []T, limit int) []T
- func Truncate(s string, max int) string
- type ChatResolveOptions
- type NameFlags
Constants ¶
This section is empty.
Variables ¶
ReservedKeywords contains keywords that cannot be used as aliases. These resolve to special chats (e.g., "myself", "self", "me" -> Note to Self).
Functions ¶
func AddAccountIDs ¶
func AddCSVParam ¶
func FilterChats ¶
func FilterUnreadMessages ¶
func FormatTime ¶
func IsReservedKeyword ¶ added in v0.2.1
IsReservedKeyword returns true if the input is a reserved keyword.
func LimitReplyDepth ¶ added in v0.2.1
LimitReplyDepth truncates reply chains beyond maxDepth. depth 0 = unlimited, depth 1 = no replies, depth 2 = one level of replies, etc.
func LimitSlice ¶
func LooksLikeChatID ¶
LooksLikeChatID returns true if the string looks like a chat ID rather than a name.
func MessageDisplayText ¶
func MessageSender ¶
func NewestSortKey ¶
func NormalizeDateAfter ¶
func OffsetSlice ¶ added in v0.2.1
OffsetSlice skips the first n items from a slice.
func OldestSortKey ¶
func OtherChatName ¶
func PaginateSlice ¶ added in v0.2.1
PaginateSlice applies offset and limit to a slice.
func ParseRelativeTime ¶ added in v0.2.1
ParseRelativeTime parses human-friendly time expressions. Supports: "2h ago", "yesterday", "monday", "next tue", "30m", RFC3339, YYYY-MM-DD.
func Poll ¶
func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, onError func(error) bool) error
Poll runs fn every interval until the context is canceled. If onError is nil, any error from fn stops polling. If onError returns true, polling continues after an error.
func ResolveChatByName ¶
func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatByName searches for a chat by name and returns its ID. If multiple matches are found, it errors unless First is set.
func ResolveChatIDFromArgOrFlag ¶
func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, flagValue, flagName string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromArgOrFlag resolves a chat ID using either a flag value (chat name) or a positional chat ID argument.
func ResolveChatIDFromFlags ¶
func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, nameFlag, idFlag, nameLabel, idLabel string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromFlags resolves a chat ID using either a chat name or explicit chat ID flag.
func ResolveChatIdentifier ¶ added in v0.2.1
func ResolveChatIdentifier(input string, aliases map[string]string, noteToSelfID string) (string, error)
ResolveChatIdentifier resolves a chat identifier to a chat ID. Resolution order: 1. Reserved keywords (myself, self, me) -> Note to Self chat 2. Literal chat ID (starts with !) -> return as-is 3. Alias lookup -> resolved ID 4. Error