urlarg

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package urlarg provides utilities for parsing Basecamp URLs into IDs. This allows users to paste URLs from the browser as command arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCommentWithProject

func ExtractCommentWithProject(arg string) (id, projectID string)

ExtractCommentWithProject extracts a comment ID and project ID from an argument. For URLs with a fragment (e.g., #__recording_789), returns the comment ID. For URLs without a fragment, returns the recording ID (same as ExtractWithProject). Returns (commentOrRecordingID, projectID).

func ExtractID

func ExtractID(arg string) string

ExtractID extracts the primary ID from an argument. If the argument is a Basecamp URL, extracts the recording ID. Otherwise, returns the argument as-is (assumed to be an ID).

func ExtractIDs

func ExtractIDs(args []string) []string

ExtractIDs extracts IDs from multiple arguments, handling URLs.

func ExtractProjectID

func ExtractProjectID(arg string) string

ExtractProjectID extracts the project (bucket) ID from an argument. If the argument is a Basecamp URL, extracts the bucket ID. Otherwise, returns the argument as-is.

func ExtractWithProject

func ExtractWithProject(arg string) (recordingID, projectID string)

ExtractWithProject extracts both the recording ID and project ID from an argument. Returns (recordingID, projectID). If projectID is empty, it wasn't in the URL.

func IsURL

func IsURL(input string) bool

IsURL checks if the input looks like a Basecamp URL. Returns true if the URL can be matched (either as an API route or structurally).

Types

type Parsed

type Parsed struct {
	AccountID   string
	ProjectID   string // BucketID in Basecamp terminology
	Type        string // e.g., "todos", "messages", "cards"
	RecordingID string
	CommentID   string
}

Parsed represents components extracted from a Basecamp URL.

Jump to

Keyboard shortcuts

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