common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset = "\033[0m"
	Blue  = "\033[94m"
	Green = "\033[92m"
	Fail  = "\033[91m"
)

Variables

View Source
var RedmineCloseCmd = &cobra.Command{
	Use:   "close",
	Short: "Close an existing issue in Redmine",
	Run: func(cmd *cobra.Command, args []string) {
		Init()
		service, _ := cmd.Flags().GetString("service")
		message, _ := cmd.Flags().GetString("message")
		RedmineClose(service, message)
	},
}
View Source
var RedmineCmd = &cobra.Command{
	Use:   "redmine",
	Short: "Redmine-related utilities",
}
View Source
var RedmineCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a new issue in Redmine",
	Run: func(cmd *cobra.Command, args []string) {
		Init()
		service, _ := cmd.Flags().GetString("service")
		subject, _ := cmd.Flags().GetString("subject")
		message, _ := cmd.Flags().GetString("message")
		RedmineCreate(service, subject, message)
	},
}
View Source
var RedmineShowCmd = &cobra.Command{
	Use:   "show",
	Short: "Get the issue ID of the issue if it is opened",
	Run: func(cmd *cobra.Command, args []string) {
		Init()
		service, _ := cmd.Flags().GetString("service")
		RedmineShow(service)
	},
}
View Source
var RedmineUpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update an existing issue in Redmine",
	Run: func(cmd *cobra.Command, args []string) {
		Init()
		service, _ := cmd.Flags().GetString("service")
		message, _ := cmd.Flags().GetString("message")
		RedmineUpdate(service, message)
	},
}
View Source
var ScriptName string
View Source
var TmpDir = "/tmp/mono/"
View Source
var TmpPath string

Functions

func Alarm

func Alarm(message string)

func AlarmCheckDown

func AlarmCheckDown(service string, message string)

func AlarmCheckUp

func AlarmCheckUp(service string, message string)

func ConfInit

func ConfInit(configName string, config interface{}) interface{}

func ConvertBytes

func ConvertBytes(bytes uint64) string

func Init

func Init()

func LogError

func LogError(err string)

func LogInit

func LogInit()

func PrettyPrint

func PrettyPrint(name string, lessOrMore string, value float64, hasPercentage bool, wantFloat bool)

func RedmineClose added in v0.2.0

func RedmineClose(service string, message string)

func RedmineCreate

func RedmineCreate(service string, subject string, message string)

func RedmineShow added in v0.3.0

func RedmineShow(service string)

func RedmineUpdate

func RedmineUpdate(service string, message string)

func SplitSection

func SplitSection(section string)

Types

type Common

type Common struct {
	Identifier string

	Alarm struct {
		Enabled      bool
		Interval     float64
		Webhook_urls []string
	}

	Redmine struct {
		Enabled     bool
		Project_id  string
		Tracker_id  int
		Status_id   int
		Priority_id int

		Api_key string
		Url     string
	}
}
var Config Common

type Issue

type Issue struct {
	Id             int    `json:"id,omitempty"`
	Notes          string `json:"notes,omitempty"`
	ProjectId      string `json:"project_id,omitempty"`
	TrackerId      int    `json:"tracker_id,omitempty"`
	Description    string `json:"description,omitempty"`
	Subject        string `json:"subject,omitempty"`
	PriorityId     int    `json:"priority_id,omitempty"`
	StatusId       int    `json:"status_id,omitempty"`
	StatusIdString string `json:"status_id,omitempty"`
}

type RedmineIssue

type RedmineIssue struct {
	Issue Issue `json:"issue"`
}

type ResponseData

type ResponseData struct {
	Result string `json:"result"`
	Msg    string `json:"msg"`
	Code   string `json:"code"`
}

Jump to

Keyboard shortcuts

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