issues

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConfig = errors.New("No .fit.yml provided")

ErrNoConfig

View Source
var ErrNoDescription = errors.New("No description provided")

ErrNoDescription defines a new error.

View Source
var ErrNotFound = errors.New("Could not find issue")

ErrNotFound defines a new error.

Functions

func ConfigRead

func ConfigRead(bugYmls string, c *Config, progVersion string) (err error)

ConfigRead assigns values to the Config type from .fit.yml.

func ConfigWrite

func ConfigWrite(bugYmls string) (err error)

func TitleToDirString

func TitleToDirString(title string) string

Types

type Comment

type Comment struct {
	Author string
	Time   time.Time
	Body   string
	Order  int
	Xml    []byte
}

Comment is the struct type of a unit of discussion about an issue.

type Config

type Config struct {
	// FitDir aka RootDir or RepoDir
	// storage of location of dir containing:
	//     issues directory
	//     .fit.yml
	//     likely .git
	// overridden by FIT/PMIT environment variable    ** runtime only
	FitDir string `json:"FitDir"`
	// overridden by FIT/PMIT environment variable    ** runtime only
	FitDirName string `json:"FitDirName"`
	// save the detected directory name               ** runtime only
	ScmDir string `json:"ScmDir"`
	// save the detected scm type                     ** runtime only
	ScmType string `json:"ScmType"`
	// FitYmlDir                         * if present ** runtime only
	// Now important because this could be FitDir or ScmDir
	FitYmlDir string `json:"FitYmlDir"`
	// FitYmlDir+"/.fit.yml" or .bug.yml * if present ** runtime only
	FitYml string `json:"FitYml"`
	// Description contents for new issue or empty file (empty default)
	// relative to FitYmlDir, aka FitDir or ScmDir
	DefaultDescriptionFile string `json:"DefaultDescriptionFile"`
	// saves raw json files of import (true) or don't save (false, default)
	ImportXmlDump bool `json:"ImportXmlDump"`
	// import comments together (true) or separate files (false, default)
	ImportCommentsTogether bool `json:"ImportCommentsTogether"`
	// append to the program version ** runtime + append
	ProgramVersion string `json:"ProgramVersion"`
	// file name (Description is the default) set in main.go
	DescriptionFileName string `json:"DescriptionFileName"`
	// tag_key_value (true) or tag subdir (false, default)
	TagKeyValue bool `json:"TagKeyValue"`
	// tag_Field_value (true) or Field file and contents (false, default)
	NewFieldAsTag bool `json:"NewFieldAsTag"`
	// tag_field_value (true) or tag_Field_value (false, default)
	NewFieldLowerCase bool `json:"NewFieldLowerCase"`
	// github.com/settings/tokens
	GithubPersonalAccessToken string `json:"GithubPersonalAccessToken"`
	//* twilio.com/console "Dashboard" has the "account sid" public acct identifier
	TwilioAccountSid string `json:"TwilioAccountSid"`
	//* twilio "Auth Token" is the "Rest API Key" is for access
	TwilioAuthToken string `json:"TwilioAuthToken"`
	//* your twilio number
	TwilioPhoneNumberFrom string `json:"TwilioPhoneNumberFrom"`
	//* base url for notifications
	FitSite string `json:"FitSite"`
	// fit directories always recursive (true) or need -r cli option (false, default)
	MultipleDirs bool `json:"MultipleDirs"`
	// close will add tag_status_close (true) or not (false, default)
	CloseStatusTag bool `json:"CloseStatusTag"`
	// close will move (true, sets ClosePreventDelete=true) or not (false, default)
	CloseMove bool `json:"CloseMove"`
	// if using CloseMove this is inside FitDir
	ClosedDirName string `json:"ClosedDirName"`
	// close will prevent delete (true) or not (false), implies CloseMove or CloseStatusTag
	ClosePreventDelete bool `json:"ClosePreventDelete"`
	// Abbreviate Identifier as Id (true) or use Identifier (false, default)
	IdAbbreviate bool `json:"IdAbbreviate"`
	// Identifier Automatic assignment (true) or not (false, default)
	IdAutomatic bool `json:"IdAutomatic"`
}

Config type holds .fit.yml configured values.

type Directory

type Directory string

Directory type is a string path name.

func FitDirer

func FitDirer(config Config) Directory

FitDirer returns the directory containing the issues. The root directory contains the issues directory.

func RootDirer

func RootDirer(config *Config) Directory

RootDirer returns the directory usually containing the fit subdirectory.

func ShortTitleToDir

func ShortTitleToDir(title string) Directory

ShortTitleToDir truncates a title to 25 characters.

func TitleToDir

func TitleToDir(title string) Directory

TitleToDir returns a Directory from a string argument.

func (Directory) ModTime

func (d Directory) ModTime() time.Time

ModTime returns the last modified time from the file system.

func (Directory) ShortNamer

func (d Directory) ShortNamer() Directory

ShortNamer returns the directory name of a bug

func (Directory) ToTitle

func (d Directory) ToTitle() string

ToTitle decodes the human string from the filesystem directory name.

type Issue

type Issue struct {
	Dir Directory

	DescriptionFileName string
	TagArray            []TagKeyValue
	// contains filtered or unexported fields
}

An issue

func FindIssuesByTag

func FindIssuesByTag(tags []string, config Config) []Issue

FindIssuesByTag returns an array of tagged issues.

func GetAllIssues

func GetAllIssues(config Config) []Issue

GetAllIssues returns an array of all issues.

func LoadIssueByDirectory

func LoadIssueByDirectory(dir string, config Config) (*Issue, error)

LoadIssueByDirectory returns an issue from the directory name.

func LoadIssueByHeuristic

func LoadIssueByHeuristic(id string, config Config) (*Issue, error)

LoadIssueByHeuristic returns an issue.

func LoadIssueByIdentifier

func LoadIssueByIdentifier(id string, config Config) (*Issue, error)

LoadIssueByIdentifier returns an issue from a string Identifier

func LoadIssueByIndex

func LoadIssueByIndex(idx int, config Config) (*Issue, error)

LoadIssueByIndex returns an issue from an int index.

func New

func New(title string, config Config) (*Issue, error)

New prepares an issue directory.

func (Issue) Close

func (i Issue) Close() error

Close returns an error if there is an error closing the descFile of an issue.

func (*Issue) CommentIssue

func (b *Issue) CommentIssue(comment Comment, config Config)

CommentIssue writes a text file for an issue.

func (Issue) Description

func (b Issue) Description() string

Description returns a string of an issue.

func (Issue) Direr

func (b Issue) Direr() Directory

Direr returns the directory of an issue.

func (Issue) HasTag

func (b Issue) HasTag(tag TagBoolTrue) bool

HasTag returns if an issue is assigned a tag.

func (Issue) Identifier

func (b Issue) Identifier() string

Identifier returns the string from the Identifier of an issue.

func (Issue) Len

func (t Issue) Len() int

func (*Issue) LoadIssue

func (b *Issue) LoadIssue(dir Directory, config Config)

LoadIssue sets an issue's directory, modtime and DescriptionFileName and enforces IdAutomatic.

func (Issue) Milestone

func (b Issue) Milestone() string

Milestone returns the string from the Milestone file of an issue.

func (Issue) Priority

func (b Issue) Priority() string

Priority returns the string from the Priority file of an issue.

func (*Issue) Read

func (i *Issue) Read(p []byte) (int, error)

func (*Issue) Remove

func (i *Issue) Remove() error

Remove deletes the directory and files of an issue.

func (*Issue) RemoveComment

func (b *Issue) RemoveComment(comment Comment)

RemoveComment deletes a comment file of an issue.

func (*Issue) RemoveTag

func (b *Issue) RemoveTag(tag TagBoolTrue, config Config)

RemoveTag deletes a tag file of an issue.

func (*Issue) SetDescription

func (b *Issue) SetDescription(val string, config Config) error

SetDescription writes the Description file of an issue.

func (Issue) SetField

func (b Issue) SetField(fieldName string, value string, config Config) error

SetField writes the string value to the file of an issue. NewFieldAsTag and NewFieldLowerCase are respected

func (Issue) SetIdentifier

func (b Issue) SetIdentifier(newValue string, config Config) error

SetIdentifier writes the Identifier file to an issue.

func (Issue) SetMilestone

func (b Issue) SetMilestone(newValue string, config Config) error

SetMilestone writes the Milestone file to an issue.

func (Issue) SetPriority

func (b Issue) SetPriority(newValue string, config Config) error

SetPriority writes the Priority file to an issue.

func (Issue) SetStatus

func (b Issue) SetStatus(newStatus string, config Config) error

SetStatus writes the Status file to an issue.

func (Issue) Status

func (b Issue) Status() string

Status returns the string from the Status file of an issue.

func (Issue) StringTags

func (b Issue) StringTags() []string

StringTags gets all Tags and returns []string.

func (*Issue) TagIssue

func (b *Issue) TagIssue(tag TagBoolTrue, config Config)

TagIssue writes an empty *boolean* tag file: key, no value

func (Issue) Tags

func (b Issue) Tags() []TagBoolTrue

Tags returns an issue's array of tags.

func (Issue) Title

func (b Issue) Title(options string) string

Title returns a string with the name of an issue and optionally present Identifier, Status, Priority and tags.

func (Issue) ToJSONString

func (i Issue) ToJSONString() (string, error)

ToJSONString encodes an issue. A string and an error are returned.

func (Issue) ViewIssue

func (b Issue) ViewIssue()

ViewIssue outputs an issue.

func (*Issue) Write

func (i *Issue) Write(data []byte) (n int, err error)

func (*Issue) WriteAt

func (i *Issue) WriteAt(data []byte, off int64) (n int, err error)

WriteAt makes a directory, writes a byte string to the Description using an offset. It returns the number of bytes written and an error.

type IssueNotFoundError

type IssueNotFoundError string

IssueNotFoundError defines a new error.

func (IssueNotFoundError) Error

func (b IssueNotFoundError) Error() string

Error returns a string of the error.

type TagBoolTrue

type TagBoolTrue string

TagBoolTrue only has a string key. Implied values are true/present and false/absent.

type TagKeyValue

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

TagKeyValue were added after type Tag (renamed to TagBoolTrue)

Jump to

Keyboard shortcuts

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