Documentation ¶
Overview ¶
Ticket implements routines for working with Giticket Tickets
The ticket package uses the git2go library to work with git repositories.
Index ¶
- func AddComment(t *Ticket, comment string, thisRepo *git.Repository, branchName string, ...) (string, error)
- func AddLabel(t *Ticket, label string, repo *git.Repository, branchName string, debug bool) string
- func DeleteComment(t *Ticket, commentID int, repo *git.Repository, branchName string, debug bool) string
- func DeleteLabel(t *Ticket, label string, repo *git.Repository, branchName string, debug bool) string
- func FilterTickets(tickets []Ticket, filterName string, debugFlag bool) (*[]Ticket, error)
- func GetCurrentFilter(debugFlag bool) (string, error)
- func HandleComment(branchName string, comment string, commentID int, ticketID int, ...) (string, error)
- func HandleCreate(branchName string, created int64, title string, description string, ...) (int, string, error)
- func HandleDelete(ticketID int, branchName string, debugFlag bool) (bool, error)
- func HandleFilterCreate(filter string, filterName string, debugFlag bool) error
- func HandleFilterDelete(filterName string, debugFlag bool) error
- func HandleFilterList(writer io.Writer, outputFormat string, debugFlag bool) error
- func HandleLabel(branchName string, label string, deleteFlag bool, ticketID int, debugFlag bool) error
- func HandleList(w io.Writer, windowWidth int, branchName string, filterName string, ...) error
- func HandlePriority(ticketID int, priority int, debugFlag bool) error
- func HandleSeverity(ticketID int, severity int, debugFlag bool) error
- func HandleShow(ticketID int, output string, debugFlag bool, helpFlag bool) error
- func HandleStatus(status string, ticketID int, helpFlag bool, debugFlag bool) error
- func ListTickets(thisRepo *git.Repository, branchName string, windowWidth int, ...) (string, error)
- func PrintParameterMissing(param string)
- func ReadNextTicketID(repo *git.Repository, commit *git.Commit) (int, error)
- func ShowTicket(ticket Ticket, output string, debug bool)
- func ShowTicketsJson(t Ticket, debug bool)
- func ShowTicketsText(t Ticket, debug bool)
- func ShowTicketsYaml(t Ticket, debug bool)
- func TestHandleLabel(t *testing.T)
- func WriteFilters(filters *FilterList, commitMessage string, branchName string, debugFlag bool) error
- type Comment
- type Filter
- type FilterList
- type Ticket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddComment ¶
func AddComment(t *Ticket, comment string, thisRepo *git.Repository, branchName string, debug bool) (string, error)
AddComment adds a comment to ticket t under the repo and branchName provided with a debug flag. It returns a string representing the unique ID of the added comment and an error if there is was one.
func AddLabel ¶
AddLabel() takes a pointer to a ticket, a label, a git repo, a branch name, and a debug flag. It adds the label to the ticket and returns an error.
func DeleteComment ¶
func DeleteComment(t *Ticket, commentID int, repo *git.Repository, branchName string, debug bool) string
DeleteComment removes the comment identified by commentID from ticket t under the repo and branchName provided with a debug flag. It returns a string representing the unique ID of the deleted comment.
func DeleteLabel ¶
func DeleteLabel(t *Ticket, label string, repo *git.Repository, branchName string, debug bool) string
DeleteLabel() takes a pointer to a ticket, a label, a git repo, a branch name, and a debug flag. It deletes the label from the ticket and returns an error.
func FilterTickets ¶ added in v0.3.2
FilterTickets takes a list of tickets, a filter name, and a debug flag. It returns a list of tickets that match the filter. Returns an error if there is one.
func GetCurrentFilter ¶ added in v0.3.2
GetCurrentFilter takes a debug flag and returns the name of the current filter. Returns an error if there is one. This function may return an empty string if the current filter has not yet been set.
func HandleComment ¶
func HandleComment( branchName string, comment string, commentID int, ticketID int, deleteFlag bool, debugFlag bool, ) (string, error)
HandleComment handles the addition or deletion of a comment for a ticket. It takes in the branch name, comment content, comment ID, ticket ID, delete flag, and debug flag as parameters. If the delete flag is true, it deletes the specified comment from the ticket. Otherwise, it adds the comment to the ticket. The function returns the comment ID and an error if there is one.
func HandleCreate ¶
func HandleDelete ¶
Delete the comment from the tree for the ticket with the given ID
func HandleFilterCreate ¶ added in v0.3.2
HandleFilterCreate takes a filter string, a filter name, and a debug flag and creates a filter. It returns an error if there is one.
func HandleFilterDelete ¶ added in v0.3.2
HandleFilterDelete takes the name of a filter and a debug flag, and deletes the filter. It returns an error if there is one.
func HandleFilterList ¶ added in v0.3.2
HandleFilterList takes a debug flag and lists all filters. It returns an error if there is one.
func HandleLabel ¶
func HandleLabel( branchName string, label string, deleteFlag bool, ticketID int, debugFlag bool, ) error
HandleLabel handles adding or deleting a label from a ticket based on the value of deleteFlag, returning an error if there was one.
func HandleList ¶
func HandlePriority ¶
HandlePriority sets the priority of a giticket ticket
func HandleSeverity ¶
HandleSeverity sets the severity of a giticket ticket
func HandleShow ¶
HandleShow is used to print a list of giticket tickets in a number of formats
func HandleStatus ¶
func ListTickets ¶
func PrintParameterMissing ¶
func PrintParameterMissing(param string)
func ReadNextTicketID ¶
Return the value of ".giticket/next_ticket_id" from the given commit as an int, or returns 0 and an error. Make sure to write the incremented value back things to ".giticket/next_ticket_id" in the same commit. Repo is required to lookup treeIDs
func ShowTicket ¶
ShowTicket takes a ticket, an output type, and a debug flag and prints the ticket details in the given format.
func ShowTicketsJson ¶
ShowTicketsJson is used to print a list of giticket tickets in json format
func ShowTicketsText ¶
ShowTicketsText is used to print a list of giticket tickets in text format
func ShowTicketsYaml ¶
ShowTicketsYaml is used to print a list of giticket tickets in yaml format
func TestHandleLabel ¶
func WriteFilters ¶ added in v0.3.2
func WriteFilters(filters *FilterList, commitMessage string, branchName string, debugFlag bool) error
Types ¶
type Comment ¶
A comment for a giticket ticket The fields must be filled in to populate details of the ticket
type Filter ¶ added in v0.3.2
Filter is used in ticket list operations to return a subset of tickets
type FilterList ¶ added in v0.3.2
FilterList is a list of Filters and a value that represents the 'current' filter to use
func GetFilters ¶ added in v0.3.2
func GetFilters(branchName string, debugFlag bool) (*FilterList, error)
type Ticket ¶
type Ticket struct { Title string Description string Labels []string Priority int Severity int Status string Comments []Comment NextCommentID int `yaml:"next_comment_id" json:"next_comment_id"` // Set automatically ID int Created int64 }
func FilterTicketsByID ¶
FilterTicketsByID takes a list of tickets and an integer representing the ticket ID to filter for, and return that ticket.
func GetListOfTickets ¶
func GetTicketsList ¶
GetTicketsList takes no parameters and returns a list of tickets It is intended to be used by giticket-webui, GetListOfTickets requires a repo parameter, this creates the repo and calls GetListOfTickets
func (*Ticket) TicketFilename ¶
TicketFilename() returns the filename of the ticket by cating the ticket ID and the ticket title, with spaces replaced by underscores
func (*Ticket) TicketToYaml ¶
TicketToYaml() returns the ticket as a YAML string which is used to save to disk