cmd

package
v0.0.0-...-b4ff994 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "hk",
	Short: "hakuna.ch cli tool",
	Long: `Control Hakuna.ch time tracking from the comfort of your command line.
Useful for any programmer with an aversion to the browser ;)`,
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func HandleError

func HandleError(err error)

HandleError simply logs the error and hard quits the app

Types

type AbsenceResponse

type AbsenceResponse struct {
	ID                      int       `json:"id"`
	Starts                  string    `json:"start_date"`
	Ends                    string    `json:"end_date"`
	FirstHalfDay            bool      `json:"first_half_day"`
	SecondHalfDay           bool      `json:"second_half_day"`
	Recurring               bool      `json:"is_recurring"`
	WeeklyRepeatingInterval int       `json:"weekly_repeating_interval"`
	User                    User      `json:"user"`
	TimeType                TimerType `json:"time_type"`
}

AbsenceResponse is a single absence in hakuna

type AbsenceResponseArray

type AbsenceResponseArray []AbsenceResponse

AbsenceResponseArray represents the response to the absences path

type OrgResponse

type OrgResponse []OrgUser

OrgResponse is a slice of org users

type OrgUser

type OrgUser struct {
	User          User `json:"user"`
	FirstHalfDay  bool `json:"absent_first_half_day"`
	SecondHalfDay bool `json:"absent_second_half_day"`
	TimerRunning  bool `json:"has_timer_running"`
}

OrgUser represents a user in an organization

type PingResponse

type PingResponse struct {
	Pong string `json:"pong"`
}

PingResponse contains a pong, not actually used in the cli. Included for completeness

type Project

type Project struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Archived bool   `json:"archived"`
}

Project represents a project item embedded in another type

type ProjectResponse

type ProjectResponse []struct {
	Project
	Teams []string `json:"teams"`
}

ProjectResponse represents an slice of project responses in Hakuna

type StatsResponse

type StatsResponse struct {
	Overtime        string `json:"overtime"`
	OvertimeSeconds int    `json:"overtime_in_seconds"`
	Vacation        struct {
		Redeemed  float32 `json:"redeemed_days"`
		Remaining float32 `json:"remaining_days"`
	} `json:"vacation"`
}

StatsResponse represents your current stats

type TimeEntryPayload

type TimeEntryPayload struct {
	Starts    string `json:"starts"`
	Ends      string `json:"ends"`
	TimeType  int    `json:"time_type_id"`
	ProjectID int    `json:"project_id,omitempty"`
	Note      string `json:"note"`
}

TimeEntryPayload represents the data to send when adding a new time entry

type TimeEntryResponse

type TimeEntryResponse struct {
	ID              int       `json:"id"`
	Starts          string    `json:"starts"`
	Ends            string    `json:"ends"`
	Duration        string    `json:"duration"`
	DurationSeconds int       `json:"duration_in_seconds"`
	Note            string    `json:"note"`
	User            User      `json:"user"`
	Type            TimerType `json:"type"`
	Project         Project   `json:"project"`
}

TimeEntryResponse represents a time entry retrieved from hakuna

type TimeEntryResponseArray

type TimeEntryResponseArray []TimeEntryResponse

TimeEntryResponseArray represents a slice of time entries

type TimerResponse

type TimerResponse struct {
	Date            string    `json:"date"`
	Start           string    `json:"start_time"`
	Duration        string    `json:"duration"`
	DurationSeconds int       `json:"duration_in_seconds"`
	Note            string    `json:"note"`
	User            User      `json:"user"`
	Type            TimerType `json:"type"`
	Project         Project   `json:"project"`
}

TimerResponse represents a timer response from Hakuna

type TimerStartPayload

type TimerStartPayload struct {
	ID        int    `json:"time_type_id"`
	Start     string `json:"start_time,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
	Note      string `json:"note,omitempty"`
}

TimerStartPayload is passed when starting a new timer

type TimerStopPayload

type TimerStopPayload struct {
	End string `json:"end_time,omitempty"`
}

TimerStopPayload sends an optional end time to the api

type TimerType

type TimerType struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Excluded bool   `json:"excluded_from_calculations"`
}

TimerType represents a timer type in Hakuna

type TimerTypesResponse

type TimerTypesResponse []struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Archived bool   `json:"archived"`
	Exclude  bool   `json:"exclude_from calculations"`
}

TimerTypesResponse represents an slice of possible timer types from the Hakuna API

type User

type User struct {
	ID    int      `json:"id"`
	Name  string   `json:"name"`
	Teams []string `json:"teams"`
}

User represents a user type in Hakuna

type UserResponse

type UserResponse []User

UserResponse is a slice of users

Jump to

Keyboard shortcuts

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