shared

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 14 Imported by: ? modules, 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 shared holds what the work-item commands have in common: the --json field contract, work item type resolution and work dates.

Index

Constants

View Source
const DateHelp = `` /* 205-byte string literal not displayed */

DateHelp explains --date for command help.

View Source
const FieldsHelp = `` /* 318-byte string literal not displayed */

FieldsHelp documents Fields for command help.

Variables

View Source
var Fields = []string{"id", "date", "duration", "author", "type", "text", "issue", "url"}

Fields are the --json fields of a work item.

Functions

func IssueProject

func IssueProject(ctx context.Context, c *transport.Client, host hosts.Host, issueID string) (adapter.IssueProject, error)

IssueProject reads the named issue's readable ID and project.

func ItemOnIssue

func ItemOnIssue(ctx context.Context, c *transport.Client, host hosts.Host, issue adapter.IssueProject, named, itemID string) (adapter.WorkItem, error)

ItemOnIssue reads a work item and checks that it belongs to issue, the issue named on the command line as YouTrack resolved it (so a database ID or an old project alias still matches). Work item IDs are global, so edit and delete must not trust the issue in the URL to scope them.

func NotFound

func NotFound(err error, issueID, itemID string, host hosts.Host) error

NotFound turns a 404 on a work item into a clear message.

func ParseItemID

func ParseItemID(arg string) (string, error)

ParseItemID checks a work item ID argument.

func ResolveType

func ResolveType(ctx context.Context, c *transport.Client, p adapter.IssueProject, name string) (string, error)

ResolveType finds the ID of the work item type called name (ignoring case), or whose ID is name, in the time tracking settings of the issue's project p.

func WorkDate

func WorkDate(f *cmdutil.Factory, raw string) (time.Time, error)

WorkDate resolves a --date value with the configured work timezone.

Types

type WorkItem

type WorkItem struct {
	adapter.WorkItem
	Host  hosts.Host
	Issue string
}

WorkItem exports an adapter.WorkItem under the --json field names.

func New

func New(item adapter.WorkItem, host hosts.Host, issueID string) WorkItem

New wraps item, falling back to issueID when YouTrack did not say which issue it belongs to.

func (WorkItem) Day

func (w WorkItem) Day() string

Day is the work item's date as YYYY-MM-DD, or "" when it has none.

func (WorkItem) ExportData

func (w WorkItem) ExportData(fields []string) map[string]any

func (WorkItem) Presentation

func (w WorkItem) Presentation() string

Presentation is YouTrack's rendering of the duration, or ytrack's own when YouTrack sent none.

Jump to

Keyboard shortcuts

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