cli

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: GPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RESET string = "\033[0m"
	// 3-4 bits color
	BLACK   COLOR = "\033[0;30m"
	RED     COLOR = "\033[0;31m"
	GREEN   COLOR = "\033[0;32m"
	YELLOW  COLOR = "\033[0;33m"
	BLUE    COLOR = "\033[0;34m"
	MAGENTA COLOR = "\033[0;35m"
	CYAN    COLOR = "\033[0;36m"
	WHITE   COLOR = "\033[0;37m"
	// RGB colors
	GREY COLOR = "\033[0;38;2;128;128;128m"
)
View Source
const DateLayout string = "2006-01-02"
View Source
const MainBoardName = "My Board"

Variables

View Source
var (
	ERROR   = LoggerOptions{Badge: " ✖", Color: RED}
	WARNING = LoggerOptions{Badge: " ⚠", Color: YELLOW}
	SUCCESS = LoggerOptions{Badge: " ✔", Color: GREEN}
)

Functions

func BulkFunc

func BulkFunc(ids []int, successMsgPrefix string, renderer Renderer, c *cli.Context, mapperFunc MapFunction) error

func CaptureOutput

func CaptureOutput(f func()) string

func Difference

func Difference(a, b time.Time) (year, month, day, hour, min, sec int)

func GetCliApp

func GetCliApp() *cli.App

func GetDurationText

func GetDurationText(a, b time.Time) string

func GetItemUseCase added in v0.0.2

func GetItemUseCase(workspace string, config AppConfig) usecases.ItemUseCase

func GroupByCreationDate

func GroupByCreationDate(item entities.Manageable) string

func GroupByStatus

func GroupByStatus(item entities.Manageable) string

func GroupByTag

func GroupByTag(item entities.Manageable) string

Types

type AppConfig

type AppConfig struct {
	DataDirectory         string `json:"data_directory"`
	DisplayCompletedTasks bool   `json:"display_completed_tasks"`
	DefaultDisplayMode    string `json:"default_display_mode"`
	DefaultWorkplace      string `json:"default_workplace"`
}

func GetAppConfig

func GetAppConfig(path string, defaultDataDir string) AppConfig

type COLOR

type COLOR string

func GetColorStatus

func GetColorStatus(min, max, i int) COLOR

type ConsoleRenderer

type ConsoleRenderer struct{}

func (*ConsoleRenderer) Colorify

func (Logger *ConsoleRenderer) Colorify(message interface{}, color COLOR) string

func (*ConsoleRenderer) Error

func (Logger *ConsoleRenderer) Error(message string) error

func (*ConsoleRenderer) Log

func (Logger *ConsoleRenderer) Log(option LoggerOptions, message string) error

func (*ConsoleRenderer) Success

func (Logger *ConsoleRenderer) Success(message string) error

func (*ConsoleRenderer) Warning

func (Logger *ConsoleRenderer) Warning(message string) error

type GetKey

type GetKey func(item entities.Manageable) string

type ItemGroup

type ItemGroup struct {
	Name  string
	Items entities.ItemCollection
}

func (*ItemGroup) Print

func (g *ItemGroup) Print(renderer Renderer, summarizer ItemSummarizer)

type ItemGroupCollection added in v0.0.2

type ItemGroupCollection []ItemGroup

func Filter added in v0.0.2

func Filter(summary ItemGroupCollection, predicate Predicate) ItemGroupCollection

func GroupBy

func GroupBy(items entities.ItemCollection, keyFunc GetKey) ItemGroupCollection

func (ItemGroupCollection) Len added in v0.0.2

func (c ItemGroupCollection) Len() int

Sort Protocol

func (ItemGroupCollection) Less added in v0.0.2

func (c ItemGroupCollection) Less(i, j int) bool

func (ItemGroupCollection) Swap added in v0.0.2

func (c ItemGroupCollection) Swap(i, j int)

type ItemPresenter

type ItemPresenter interface {
	TimelineView(items entities.ItemCollection) error
	BoardView(items entities.ItemCollection, tags ...string) error
}

func NewItemPresenter

func NewItemPresenter(renderer Renderer) ItemPresenter

type ItemSummarizer

type ItemSummarizer func(item entities.Manageable) string

type LoggerOptions

type LoggerOptions struct {
	Badge string
	Color COLOR
}

type MapFunction

type MapFunction func(id int, c *cli.Context) error

type Predicate added in v0.0.2

type Predicate func(group ItemGroup) bool

type Renderer

type Renderer interface {
	Colorify(message interface{}, color COLOR) string
	Log(option LoggerOptions, message string) error
	Error(message string) error
	Warning(message string) error
	Success(message string) error
}

func NewRenderer

func NewRenderer() Renderer

type Summary

type Summary struct {
	TasksCount      int
	DoneCount       int
	InProgressCount int
	PendingCount    int
	NoteCount       int
}

func Summarize

func Summarize(items entities.ItemCollection) Summary

func (*Summary) GetDonePercentage

func (s *Summary) GetDonePercentage() float32

Jump to

Keyboard shortcuts

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