cli

package
v0.0.0-...-ee5b157 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cli provides command-line interface functionality for Simple Easy Tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProfile

func AddProfile(profile Profile) error

AddProfile adds a new profile to the configuration

func Error

func Error(format string, args ...interface{})

Error prints an error message

func Execute

func Execute() error

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 GetConfigAsJSON

func GetConfigAsJSON() (string, error)

GetConfigAsJSON returns configuration as JSON string for debugging

func Info

func Info(format string, args ...interface{})

Info prints an informational message

func RemoveProfile

func RemoveProfile(profileName string) error

RemoveProfile removes a profile from the configuration

func RenderProjectDetails

func RenderProjectDetails(project *domain.Project, includeTasks bool, client *APIClient, format string) error

RenderProjectDetails renders detailed project information

func RenderProjects

func RenderProjects(projects []domain.Project, defaultProjectID, format string) error

RenderProjects renders a list of projects in the specified format

func RenderTaskDetails

func RenderTaskDetails(task interface{}, format string) error

RenderTaskDetails renders detailed task information

func RenderTasks

func RenderTasks(tasks []domain.Task, format string) error

RenderTasks renders a list of tasks in the specified format

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig saves the configuration to file

func SetCurrentProfile

func SetCurrentProfile(profileName string) error

SetCurrentProfile sets the default profile

func Success

func Success(format string, args ...interface{})

Success prints a success message with a checkmark

func ValidateProfile

func ValidateProfile(profile *Profile) error

ValidateProfile validates a profile configuration

func Warning

func Warning(format string, args ...interface{})

Warning prints a warning message

Types

type APIClient

type APIClient struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

APIClient handles communication with the Simple Easy Tasks API

func NewAPIClient

func NewAPIClient(baseURL, token string) *APIClient

NewAPIClient creates a new API client

func NewAPIClientFromProfile

func NewAPIClientFromProfile(profile *Profile) *APIClient

NewAPIClientFromProfile creates an API client from a profile

func (*APIClient) CreateProject

func (c *APIClient) CreateProject(req *CreateProjectRequest) (*domain.Project, error)

CreateProject creates a new project

func (*APIClient) CreateTask

func (c *APIClient) CreateTask(projectID string, req *CreateTaskRequest) (*domain.Task, error)

CreateTask creates a new task

func (*APIClient) DeleteTask

func (c *APIClient) DeleteTask(projectID, taskID string) error

DeleteTask deletes a task

func (*APIClient) GetProject

func (c *APIClient) GetProject(projectID string) (*domain.Project, error)

GetProject retrieves a specific project

func (*APIClient) GetProjects

func (c *APIClient) GetProjects() ([]domain.Project, error)

GetProjects retrieves all projects

func (*APIClient) GetTasks

func (c *APIClient) GetTasks(projectID string, options *TaskListOptions) ([]domain.Task, error)

GetTasks retrieves tasks for a project

func (*APIClient) Health

func (c *APIClient) Health() error

Health checks the API health

func (*APIClient) Login

func (c *APIClient) Login(email, password string) (*LoginResponse, error)

Login authenticates with email and password

func (*APIClient) TestConnection

func (c *APIClient) TestConnection() error

TestConnection tests the connection to the API

func (*APIClient) UpdateTask

func (c *APIClient) UpdateTask(projectID, taskID string, req *UpdateTaskRequest) (*domain.Task, error)

UpdateTask updates an existing task

type APIError

type APIError struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
	Details    string `json:"details"`
}

APIError represents an API error response

func (*APIError) Error

func (e *APIError) Error() string

type Config

type Config struct {
	DefaultProfile string             `json:"default_profile" yaml:"default_profile"`
	Profiles       map[string]Profile `json:"profiles" yaml:"profiles"`
}

Config represents the CLI configuration

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from file

type CreateProjectRequest

type CreateProjectRequest struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

CreateProjectRequest represents a project creation request

type CreateTaskRequest

type CreateTaskRequest struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Priority    string `json:"priority"`
	AssigneeID  string `json:"assignee_id,omitempty"`
	Status      string `json:"status,omitempty"`
}

CreateTaskRequest represents a task creation request

type LoginResponse

type LoginResponse struct {
	Token string      `json:"token"`
	User  domain.User `json:"user"`
}

LoginResponse represents the response from login

type Profile

type Profile struct {
	Name      string `json:"name" yaml:"name"`
	ServerURL string `json:"server_url" yaml:"server_url"`
	Token     string `json:"token" yaml:"token"`
	ProjectID string `json:"project_id" yaml:"project_id"`
}

Profile represents a configuration profile for different environments

func GetCurrentProfile

func GetCurrentProfile() (*Profile, error)

GetCurrentProfile returns the current active profile

func ListProfiles

func ListProfiles() ([]Profile, error)

ListProfiles returns all available profiles

type TaskListOptions

type TaskListOptions struct {
	Status   []string
	Assignee string
	Priority []string
	Tags     []string
	Search   string
	Limit    int
}

TaskListOptions represents options for listing tasks

type UpdateTaskRequest

type UpdateTaskRequest struct {
	Title       *string `json:"title,omitempty"`
	Description *string `json:"description,omitempty"`
	Priority    *string `json:"priority,omitempty"`
	Status      *string `json:"status,omitempty"`
	AssigneeID  *string `json:"assignee_id,omitempty"`
}

UpdateTaskRequest represents a task update request

Jump to

Keyboard shortcuts

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