Documentation ¶
Overview ¶
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Package common contains functionality not critical to the core project but still essential.
Index ¶
- Constants
- Variables
- func AppendIfMissing(slice []string, s string) []string
- func CleanUrlSpaces(dirtyStrings ...string) []string
- func FileExists(path string) bool
- func GetChangeAction(change *object.Change) string
- func GetChangeContent(change *object.Change) (result string, contentError error)
- func GetChangePath(change *object.Change) string
- func GetChanges(commit *object.Commit, repo *git.Repository) (object.Changes, error)
- func GetRepositoryHistory(repository *git.Repository) ([]*object.Commit, error)
- func PathExists(path string) bool
- func Pluralize(count int, singular string, plural string) string
- func SetHomeDir(h string) string
- func TruncateString(str string, maxLength int) string
- type CloneConfiguration
- type IClient
- type Logger
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) Fatal(format string, args ...interface{})
- func (l *Logger) Important(format string, args ...interface{})
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Log(level int, format string, args ...interface{})
- func (l *Logger) SetDebug(d bool)
- func (l *Logger) SetSilent(s bool)
- func (l *Logger) Warn(format string, args ...interface{})
- type Owner
- type Repository
Constants ¶
const ( Name = "gitrob" ASCIIBanner = " _ __ __\n" + " ___ _(_) /________ / /\n" + " / _ `/ / __/ __/ _ \\/ _ \\\n" + " \\_, /_/\\__/_/ \\___/_.__/\n" + "/___/" )
Project name and banner
const ( FATAL = 5 ERROR = 4 WARN = 3 IMPORTANT = 2 INFO = 1 DEBUG = 0 )
These are a consistent set of error codes instead of using random non-zero integers
const ( TargetTypeUser = "User" TargetTypeOrganization = "Organization" )
Set easier names to refer to
const (
EmptyTreeCommitId = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
)
EmptyTreeCommit is a dummy commit id used as a placeholder and for testing
const GitLabTanuki = "\n" +
" // // \n" +
" //// //// \n" +
" ////// ////// \n" +
" ((((((((/////////(((((((( \n" +
" ((((((((////////((((((((( \n" +
" ((((((((((///////(((((((((( \n" +
" ((((((((/////(((((((( \n" +
" (((((///((((( \n" +
" (((/((( \n" +
" * \n" +
" GitLab Red Team \n" +
"\n"
GitLabTanuki is the Gitlab specific banner
Variables ¶
var LogColors = map[int]*color.Color{ FATAL: color.New(color.FgRed).Add(color.Bold), ERROR: color.New(color.FgRed), WARN: color.New(color.FgYellow), IMPORTANT: color.New(color.Bold), DEBUG: color.New(color.FgCyan).Add(color.Faint), }
LogColors sets the color for each type of logging output
var UserAgent = fmt.Sprintf("%s v%s", Name, Version)
UserAgent set the browser user agent when required.
var Version = version.AppVersion()
Version is the current version of gitlab
Functions ¶
func AppendIfMissing ¶
AppendIfMissing will check a slice for a value before appending it
func CleanUrlSpaces ¶
CleanUrlSpaces will take a string and replace any spaces with dashes so that is may be used in a url.
func FileExists ¶
FileExists will check for the existence of a file and return a bool depending on if it exists in a given path or not.
func GetChangeAction ¶
func GetChangeContent ¶
GetChangeContent will get the contents of a git change or patch.
func GetChangePath ¶
GetChangeAction will set the action of the commit to something that is more easily readable.
func GetChanges ¶
GetChanges will get the changes between to specific commits
func GetRepositoryHistory ¶
GetRepositoryHistory gets the commit history of a repository
func PathExists ¶
pathExists will check if a path exists or not and is used to validate user input
func Pluralize ¶
Pluralize will take in a count and if the count is != 1 it will return the singular of the word.
func TruncateString ¶
TruncateString will take an integer and cut a string at that length and append an ellipsis to it.
Types ¶
type CloneConfiguration ¶
type CloneConfiguration struct { InMemClone *bool Url *string Username *string Token *string Branch *string Depth *int }
CloneConfiguration holds the configurations for cloning a repo
type IClient ¶
type IClient interface { GetUserOrganization(login string) (*Owner, error) GetRepositoriesFromOwner(target Owner) ([]*Repository, error) GetOrganizationMembers(target Owner) ([]*Owner, error) }
IClient interface is used with the api clients to hold the repo and org specific info.
type Logger ¶
Logger holds specific configuration data for the logging
func (*Logger) Log ¶
Log is a generic printer for sending data to stdout. It does not do traditional syslog logging
func (*Logger) SetDebug ¶
SetDebug will configure the logger to enable debug output to be set to stdout