pkg

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v1.0.0

func Contains(slice []string, val string) bool

Contains is a useful method for checking if a value exists in a slice

func ConvertTagsToString added in v1.0.0

func ConvertTagsToString(tags []string) string

ConvertTagsToString converts a string slice into a formatted string of tags

func ParseTags added in v1.0.0

func ParseTags(inputTags string) []string

ParseTags parses the tags into a string slice

func Start

func Start(templatePath string, tags string, outputDirPath string, docType string)

Start is the global executor that pulls in the configuration settings, generates the content and saves the file.

Types

type Content added in v0.0.4

type Content struct {
	FormattedCurrentTime string
	TemplatePath         string
	DocumentType         string
	Tags                 string
}

Content struct which has attributes we need for generating the document

func (Content) GenerateMarkdown added in v0.0.4

func (c Content) GenerateMarkdown() string

GenerateMarkdown takes the output from a template and outputs it into a string

func (Content) GetTemplate added in v1.0.0

func (c Content) GetTemplate() (string, error)

GetTemplate gets our document template based on the input document type

func (Content) GetTemplatePath added in v0.0.4

func (c Content) GetTemplatePath(inputPath string) string

GetTemplatePath gets the template path based on if an input is passed in or if an env var is set

func (Content) ReadTemplate added in v0.0.4

func (c Content) ReadTemplate() (*bytes.Buffer, error)

ReadTemplate get a template based on the configured options and read it

type CurrentTime added in v0.0.4

type CurrentTime struct{}

CurrentTime is our struct for holding the current time

func (CurrentTime) GetCurrentDayAndTime added in v0.0.4

func (c CurrentTime) GetCurrentDayAndTime() time.Time

GetCurrentDayAndTime gets the current day and time and returns as a time.Time

type DevlogFile added in v1.0.0

type DevlogFile struct {
	OutputDirPath  string
	OutputFilePath string
}

DevlogFile holds metadata about files

func (DevlogFile) CreateFile added in v1.0.0

func (f DevlogFile) CreateFile() (*os.File, error)

CreateFile creates a file for devlog to save

func (DevlogFile) GenerateFileName added in v1.0.0

func (f DevlogFile) GenerateFileName(docType string) string

GenerateFileName generates the timestamped file prefixed with the document type TODO: refactor time.Now call here to use our time interface in util for testing

func (DevlogFile) GetFullOutputPath added in v1.0.0

func (f DevlogFile) GetFullOutputPath(docType string) string

GetFullOutputPath generates the full path with the specified directory and filename

func (DevlogFile) GetOutputPath added in v1.0.0

func (f DevlogFile) GetOutputPath() string

GetOutputPath gets a path and selects sensible defaults if one is not set

func (DevlogFile) SaveFile added in v1.0.0

func (f DevlogFile) SaveFile(outputMd string, file io.Writer, docType string) error

SaveFile saves our markdown file to the specified directory

type FileOps added in v1.0.0

type FileOps interface {
	GetOutputPath() string
	GetFullOutputPath(docType string) string
	GenerateFileName(docType string) string
	CreateFile(docType string) (*os.File, error)
	SaveFile(outputMd string, file io.Writer, docType string)
}

FileOps is the interface for devlog file operations

type TemplateReader added in v0.0.4

type TemplateReader interface {
	ReadTemplate() (*bytes.Buffer, error)
	GetTemplatePath() string
	GetTemplate() (string, error)
}

TemplateReader interface for reading templates

type TextContent added in v0.0.4

type TextContent interface {
	GenerateMarkdown() string
}

TextContent interface for text content generation

type Time added in v0.0.4

type Time interface {
	GetCurrentDayAndTime() time.Time
}

Time is our interface for any functions we need for handling time

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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