taskin

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

README


📋 Add user-friendly tasks to your terminal


Multi

Release Go Report Card Go Reference Lint Tests PRs Welcome Examples Phorm

[!TIP]

All output is Github Action friendly! You can view the output of each example here

Installation

go get github.com/fumeapp/taskin

Examples

Simplest way to line up and fire off tasks

https://github.com/fumeapp/taskin/blob/3cd766c21e5eaba5edb33f38d3781d6cf814f9f9/examples/simple/main.go#L11-L33

Simple

Using a progress bar for a task

https://github.com/fumeapp/taskin/blob/06b4d112f7d2dcf9fb4ee9b210f0be2d5cda03b5/examples/progress/main.go#L11-L24

Progress

Customize colors, spinner, and progress bar

https://github.com/fumeapp/taskin/blob/3cd766c21e5eaba5edb33f38d3781d6cf814f9f9/examples/custom/main.go#L13-L54

Custom

Nest tasks inside tasks

https://github.com/fumeapp/taskin/blob/3cd766c21e5eaba5edb33f38d3781d6cf814f9f9/examples/multi/main.go#L23-L34

Multi

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defaults = Config{
	Options: ConfigOptions{
		ExitOnFailure: true,
	},
	Spinner: spinner.Dot,
	ProgressOptions: []progress.Option{
		progress.WithDefaultGradient(),
		progress.WithoutPercentage(),
		progress.WithWidth(10),
	},
	Colors: ConfigColors{
		Spinner:       lipgloss.Color("214"),
		Pending:       lipgloss.Color("lightgrey"),
		Success:       lipgloss.Color("46"),
		Failure:       lipgloss.Color("196"),
		ParentStarted: lipgloss.Color("214"),
	},
	Chars: ConfigChars{
		ParentStarted: "»",
		NotStarted:    "•",
		Success:       "✔",
		Failure:       "✘",
	},
}

Functions

func IsCI added in v0.1.3

func IsCI() bool

Types

type Config

type Config struct {
	Options         ConfigOptions
	Spinner         spinner.Spinner
	Colors          ConfigColors
	ProgressOptions []progress.Option
	Chars           ConfigChars
}

type ConfigChars

type ConfigChars struct {
	ParentStarted string
	NotStarted    string
	Success       string
	Failure       string
}

type ConfigColors

type ConfigColors struct {
	Spinner       lipgloss.Color
	Pending       lipgloss.Color
	Success       lipgloss.Color
	Failure       lipgloss.Color
	ParentStarted lipgloss.Color
}

type ConfigOptions

type ConfigOptions struct {
	ExitOnFailure bool
}

type Runner

type Runner struct {
	Task     Task
	State    TaskState
	Spinner  *spinner.Model
	Config   Config
	Children Runners
}

func NewRunner

func NewRunner(task Task, cfg Config) Runner

type Runners

type Runners []Runner

func New

func New(tasks Tasks, cfg Config) Runners

func (*Runners) Init

func (r *Runners) Init() tea.Cmd

func (*Runners) Run

func (r *Runners) Run() error

func (*Runners) Update

func (r *Runners) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Runners) View

func (r *Runners) View() string

type Task

type Task struct {
	Title        string
	Task         func(*Task) error
	ShowProgress TaskProgress
	Bar          progress.Model
	Config       Config
	Tasks        Tasks
}

func (*Task) Progress

func (task *Task) Progress(current, total int)

type TaskProgress

type TaskProgress struct {
	Current int
	Total   int
}

type TaskState

type TaskState int
const (
	NotStarted TaskState = iota
	Running
	Completed
	Failed
)

type Tasks

type Tasks []Task

Directories

Path Synopsis
examples
custom command
multi command
progress command
simple command

Jump to

Keyboard shortcuts

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