core

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Source: https://github.com/goware/prefixer Author: goware

Index

Constants

View Source
const ANSI = "" /* 129-byte string literal not displayed */

Variables

View Source
var CONFIG_MAN []byte
View Source
var CONFIG_MD []byte

Functions

func CheckIfError

func CheckIfError(err error)

func CreateManPage added in v0.20.0

func CreateManPage(desc string, version string, date string, rootCmd *cobra.Command, cmds ...*cobra.Command) error

func DebugPrint added in v0.6.1

func DebugPrint(data any)

func Exit added in v0.22.0

func Exit(err error)

func FindFileInParentDirs added in v0.5.0

func FindFileInParentDirs(path string, files []string) (string, error)

func FormatShell added in v0.12.0

func FormatShell(shell string) string

FormatShell returns the shell program and associated command flag

func FormatShellString added in v0.20.0

func FormatShellString(shell string, command string) (string, []string)

FormatShellString returns the shell program (bash,sh,.etc) along with the command flag and subsequent commands Example: "bash", "-c echo hello world"

func GenManPages added in v0.20.0

func GenManPages(dir string) error

func GetAbsolutePath

func GetAbsolutePath(configDir string, path string, name string) (string, error)

Get the absolute path Need to support following path types:

lala/land
./lala/land
../lala/land
/lala/land
$HOME/lala/land
~/lala/land
~root/lala/land

func GetRelativePath added in v0.10.0

func GetRelativePath(configDir string, path string) (string, error)

func GetRemoteUrl

func GetRemoteUrl(path string) (string, error)

func GetWdRemoteUrl

func GetWdRemoteUrl(path string) (string, error)

func Intersection added in v0.5.0

func Intersection(a []string, b []string) []string

func Ptr added in v0.20.0

func Ptr[T any](t T) *T

Used when creating pointers to literal. Useful when you want set/unset attributes.

func ResolveTildePath added in v0.20.1

func ResolveTildePath(path string) (string, error)

Get the absolute path Need to support following path types:

lala/land
./lala/land
../lala/land
/lala/land
$HOME/lala/land
~/lala/land
~root/lala/land

func StringInSlice

func StringInSlice(a string, list []string) bool

func StringsToErrors added in v0.20.0

func StringsToErrors(str []string) []error

func Strip added in v0.10.0

func Strip(str string) string

Types

type AlreadyManiDirectory added in v0.20.0

type AlreadyManiDirectory struct {
	Dir string
}

func (*AlreadyManiDirectory) Error added in v0.20.0

func (c *AlreadyManiDirectory) Error() string

type ConfigEnvFailed added in v0.6.1

type ConfigEnvFailed struct {
	Name string
	Err  string
}

func (*ConfigEnvFailed) Error added in v0.6.1

func (c *ConfigEnvFailed) Error() string

type ConfigErr added in v0.20.0

type ConfigErr struct {
	Msg string
}

func (*ConfigErr) Error added in v0.20.0

func (f *ConfigErr) Error() string

type ConfigNotFound

type ConfigNotFound struct {
	Names []string
}

func (*ConfigNotFound) Error

func (f *ConfigNotFound) Error() string

type DirNotFound added in v0.10.0

type DirNotFound struct {
	Dirs []string
}

func (*DirNotFound) Error added in v0.10.0

func (c *DirNotFound) Error() string

type FailedToOpenFile

type FailedToOpenFile struct {
	Name string
}

func (*FailedToOpenFile) Error

func (f *FailedToOpenFile) Error() string

type FailedToParseFile

type FailedToParseFile struct {
	Name string
	Msg  error
}

func (*FailedToParseFile) Error

func (f *FailedToParseFile) Error() string

type FailedToParsePath

type FailedToParsePath struct {
	Name string
}

func (*FailedToParsePath) Error

func (f *FailedToParsePath) Error() string

type InitFlags added in v0.10.0

type InitFlags struct {
	AutoDiscovery bool
	Vcs           string
}

type ListFlags added in v0.10.0

type ListFlags struct {
	Output string
	Theme  string
	Tree   bool
}

type PathDoesNotExist

type PathDoesNotExist struct {
	Path string
}

func (*PathDoesNotExist) Error

func (p *PathDoesNotExist) Error() string

type Prefixer added in v0.20.0

type Prefixer struct {
	// contains filtered or unexported fields
}

Prefixer implements io.Reader and io.WriterTo. It reads data from the underlying reader and prepends every line with a given string.

func NewPrefixer added in v0.20.0

func NewPrefixer(r io.Reader, prefix string) *Prefixer

New creates a new instance of Prefixer.

func (*Prefixer) Read added in v0.20.0

func (r *Prefixer) Read(p []byte) (n int, err error)

Read implements io.Reader. It reads data into p from the underlying reader and prepends every line with a prefix. It does not block if no data is available yet. It returns the number of bytes read into p.

func (*Prefixer) WriteTo added in v0.20.0

func (r *Prefixer) WriteTo(w io.Writer) (n int64, err error)

type ProjectFlags added in v0.10.0

type ProjectFlags struct {
	Tags    []string
	Paths   []string
	Headers []string
	Edit    bool
}

type ProjectNotFound added in v0.10.0

type ProjectNotFound struct {
	Name []string
}

func (*ProjectNotFound) Error added in v0.10.0

func (c *ProjectNotFound) Error() string

type RunFlags added in v0.10.0

type RunFlags struct {
	Edit     bool
	Parallel bool
	DryRun   bool
	Silent   bool
	Describe bool
	Cwd      bool
	Theme    string

	All      bool
	Projects []string
	Paths    []string
	Tags     []string

	IgnoreErrors      bool
	IgnoreNonExisting bool
	OmitEmpty         bool
	Output            string
}

type SetRunFlags added in v0.20.0

type SetRunFlags struct {
	Parallel          bool
	OmitEmpty         bool
	IgnoreErrors      bool
	IgnoreNonExisting bool
}

type SizedWaitGroup added in v0.20.1

type SizedWaitGroup struct {
	Size int
	// contains filtered or unexported fields
}

SizedWaitGroup has the same role and close to the same API as the Golang sync.WaitGroup but adds a limit of the amount of goroutines started concurrently.

func NewSizedWaitGroup added in v0.20.1

func NewSizedWaitGroup(limit int) SizedWaitGroup

New creates a SizedWaitGroup. The limit parameter is the maximum amount of goroutines which can be started concurrently.

func (*SizedWaitGroup) Add added in v0.20.1

func (s *SizedWaitGroup) Add()

Add increments the internal WaitGroup counter. It can be blocking if the limit of spawned goroutines has been reached. It will stop blocking when Done is been called.

See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) AddWithContext added in v0.20.1

func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error

AddWithContext increments the internal WaitGroup counter. It can be blocking if the limit of spawned goroutines has been reached. It will stop blocking when Done is been called, or when the context is canceled. Returns nil on success or an error if the context is canceled before the lock is acquired.

See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) Done added in v0.20.1

func (s *SizedWaitGroup) Done()

Done decrements the SizedWaitGroup counter. See sync.WaitGroup documentation for more information.

func (*SizedWaitGroup) Wait added in v0.20.1

func (s *SizedWaitGroup) Wait()

Wait blocks until the SizedWaitGroup counter is zero. See sync.WaitGroup documentation for more information.

type SpecNotFound added in v0.12.0

type SpecNotFound struct {
	Name string
}

func (*SpecNotFound) Error added in v0.12.0

func (c *SpecNotFound) Error() string

type SyncFlags added in v0.10.0

type SyncFlags struct {
	Parallel    bool
	Status      bool
	SyncRemotes bool
}

type TagFlags added in v0.10.0

type TagFlags struct {
	Headers []string
}

type TagNotFound added in v0.20.0

type TagNotFound struct {
	Tags []string
}

func (*TagNotFound) Error added in v0.20.0

func (c *TagNotFound) Error() string

type TargetNotFound added in v0.12.0

type TargetNotFound struct {
	Name string
}

func (*TargetNotFound) Error added in v0.12.0

func (c *TargetNotFound) Error() string

type TaskFlags added in v0.10.0

type TaskFlags struct {
	Headers []string
	Edit    bool
}

type TaskNotFound added in v0.6.1

type TaskNotFound struct {
	Name []string
}

func (*TaskNotFound) Error added in v0.6.1

func (c *TaskNotFound) Error() string

type ThemeNotFound added in v0.10.0

type ThemeNotFound struct {
	Name string
}

func (*ThemeNotFound) Error added in v0.10.0

func (c *ThemeNotFound) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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