view

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package view is the view layer of the gogh command.

Index

Constants

This section is empty.

Variables

View Source
var ProjectFormatFullFilePath = ProjectFormatFunc(func(p gogh.Project) (string, error) {
	return p.FullFilePath(), nil
})
View Source
var ProjectFormatJSON = ProjectFormatFunc(func(p gogh.Project) (string, error) {
	utxt, err := ProjectFormatURL(p)
	if err != nil {
		return "", err
	}
	buf, _ := json.Marshal(map[string]interface{}{
		"fullFilePath": p.FullFilePath(),
		"relFilePath":  p.RelFilePath(),
		"url":          utxt,
		"relPath":      p.RelPath(),
		"host":         p.Host(),
		"owner":        p.Owner(),
		"name":         p.Name(),
	})
	return string(buf), nil
})
View Source
var ProjectFormatRelFilePath = ProjectFormatFunc(func(p gogh.Project) (string, error) {
	return p.RelFilePath(), nil
})
View Source
var ProjectFormatRelPath = ProjectFormatFunc(func(p gogh.Project) (string, error) {
	return p.RelPath(), nil
})
View Source
var ProjectFormatURL = ProjectFormatFunc(func(p gogh.Project) (string, error) {
	utxt, err := gogh.GetDefaultRemoteURLFromLocalProject(context.Background(), p)
	if err != nil {
		if errors.Is(err, git.ErrRemoteNotFound) {
			utxt = "https://" + p.RelPath()
		} else {
			return "", err
		}
	}
	return utxt, nil
})

Functions

func FuzzyAgoAbbr

func FuzzyAgoAbbr(now time.Time, at time.Time) string

Types

type ProjectFormat

type ProjectFormat interface {
	Format(p gogh.Project) (string, error)
}

func ProjectFormatFields

func ProjectFormatFields(s string) ProjectFormat

type ProjectFormatFunc

type ProjectFormatFunc func(gogh.Project) (string, error)

func (ProjectFormatFunc) Format

func (f ProjectFormatFunc) Format(p gogh.Project) (string, error)

type RepositoryFuncPrinter

type RepositoryFuncPrinter func(gogh.Repository) error

func (RepositoryFuncPrinter) Close

func (f RepositoryFuncPrinter) Close() error

func (RepositoryFuncPrinter) Print

func (f RepositoryFuncPrinter) Print(r gogh.Repository) error

type RepositoryPrinter

type RepositoryPrinter interface {
	Print(p gogh.Repository) error
	Close() error
}

func NewRepositoryJSONPrinter

func NewRepositoryJSONPrinter(w io.Writer) RepositoryPrinter

func NewRepositorySpecPrinter

func NewRepositorySpecPrinter(w io.Writer) RepositoryPrinter

func NewRepositoryURLPrinter

func NewRepositoryURLPrinter(w io.Writer) RepositoryPrinter

Directories

Path Synopsis
Package repotab provides a formatter which show repositories as a table in CLI
Package repotab provides a formatter which show repositories as a table in CLI

Jump to

Keyboard shortcuts

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