deeplink

package
v0.158.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deeplink reads the address of a page of the DataTug web app (https://datatug.app/...) into what the terminal UI needs to open the same project and page: `datatug ui --deep-link <address>`.

The address shapes are those of the web app's project-address library (datatug/datatug-apps libs/datatug/project-address):

  • GitHub: /project/github.com/<owner>/<repo>[/<dir>…][/-/<page>…][?ref=<ref>], and the legacy …/<repo>/tree/<ref>[/<dir>…][/-/<page>…] and …/<repo>/blob/<ref>[/<dir>…]/datatug-project.json;
  • any store: /store/<storeId>/project/<projectId>[/<page>…];
  • a DataTug Cloud project of a Space: /space/<spaceId>/store/firestore/project/<projectId>[/<page>…].

Parse is pure: it makes no request and touches no file.

Index

Constants

View Source
const Usage = "https://datatug.app/project/github.com/<owner>/<repo>[/<dir>…][/-/<page>…]"

Usage is the form an address must have, for messages.

Variables

View Source
var ErrInvalid = errors.New("invalid DataTug web address")

ErrInvalid is wrapped by every error of Parse. The error text never repeats the address: it may hold credentials or a query.

Functions

This section is empty.

Types

type GitHubProject

type GitHubProject struct {
	// Owner and Repo are lower case.
	Owner, Repo string
	// Folder is the repository-relative directory of the project; "" is the
	// repository root.
	Folder string
	// Ref is the branch, tag or commit, "" for the default branch.
	Ref string
}

GitHubProject locates a project in a GitHub repository.

type Kind

type Kind int

Kind is what an address names.

const (
	// KindNone is a page of the web app that is not a project (home, sign-in…):
	// the terminal UI opens on its normal start screen.
	KindNone Kind = iota
	// KindGitHub is a project in a GitHub repository.
	KindGitHub
	// KindAgent is a project served by a `datatug serve` agent on this machine.
	KindAgent
	// KindCloud is a DataTug Cloud (Firestore) project.
	KindCloud
	// KindBrowser is a project stored in the browser of the web app.
	KindBrowser
	// KindOtherStore is a project of a store the terminal UI does not know.
	KindOtherStore
)
type Link struct {
	Kind Kind
	// GitHub is set for KindGitHub.
	GitHub GitHubProject
	// StoreID and ProjectID are set for every project kind but KindGitHub;
	// SpaceID only for a Space project of DataTug Cloud.
	StoreID, ProjectID, SpaceID string
	// Page is the page of the project, as decoded segments (["query", "q1"]);
	// empty for the project's home.
	Page []string
}

Link is a parsed address.

func Parse

func Parse(raw string) (Link, error)

Parse reads an address of the web app: https://datatug.app/… or, for a development build of the web app, http://localhost:<port>/….

Jump to

Keyboard shortcuts

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