Documentation
¶
Index ¶
- func WithConfig(config *config.Config) func(*Core)
- func WithMsgChan(msgChan *chan common.Msg) func(*Core)
- type Commands
- type Core
- func (c *Core) AddCommand(name string, command string) common.Msg
- func (c *Core) AddCommandToProject(projectName string, commandName string) common.Msg
- func (c *Core) AddDomainAlias(projectName string, domainAlias string) common.Msg
- func (c *Core) AddProject(name string, domain string, port int, commandNames []string) common.Msg
- func (c *Core) AddVariable(projectName string, key string, value string) common.Msg
- func (c *Core) CommandExists(name string) (bool, string)
- func (c *Core) GetCommandNames() []string
- func (c *Core) GetCommands() (Commands, error)
- func (c *Core) GetCommandsConfig() error
- func (c *Core) GetProjectDir(projectName string) common.Msg
- func (c *Core) GetProjectNames() []string
- func (c *Core) GetProjects() (Projects, error)
- func (c *Core) GetProjectsConfig() error
- func (c *Core) Init() common.Msg
- func (c *Core) ProjectExists(name string) (bool, Project)
- func (c *Core) RemoveCommand(name string) common.Msg
- func (c *Core) RemoveCommandFromProject(projectName string, commandName string) common.Msg
- func (c *Core) RemoveDomainAlias(projectName string, domainAlias string) common.Msg
- func (c *Core) RemoveProject(name string) common.Msg
- func (c *Core) RemoveVariable(projectName string, key string) common.Msg
- func (c *Core) RenameCommand(oldName string, newName string) common.Msg
- func (c *Core) RenameProject(oldName string, newName string) common.Msg
- func (c *Core) RequireSudo() error
- func (c *Core) SetProjectDir(projectName string, dir *string) common.Msg
- func (c *Core) TryToRun(name string) common.Msg
- func (c *Core) UpdateCommand(name string, command string) common.Msg
- func (c *Core) UpdateProject(name string, domain string, port int, commandNames []string) common.Msg
- type DomainAliases
- type Project
- type Projects
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithConfig ¶
Optional function to set the config of the Core when creating a new instance.
func WithMsgChan ¶
Optional function to set the message channel of the Core when creating a new instance.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core is the main struct for the core package.
It contains the config, message channel, commands and projects. The config is used to read and update the configuration. The message channel is used to send messages to the CLI or the app.
func (*Core) AddCommand ¶
Add a command with the given name and command string.
func (*Core) AddCommandToProject ¶
Add a command to the project with the given name.
func (*Core) AddDomainAlias ¶ added in v0.7.0
Add a domain alias to the given project.
func (*Core) AddProject ¶
Add a project with the given name, domain, port and command names.
func (*Core) AddVariable ¶
Add a variable with the given key and value to the project with the given name.
func (*Core) CommandExists ¶ added in v0.6.0
Check if a command with the given name exists. Returns the command if it exists.
func (*Core) GetCommandNames ¶
Get all the names of the commands.
func (*Core) GetCommands ¶
Get the commands from the commands.json file.
func (*Core) GetCommandsConfig ¶
Get the commands from the commands.json file.
func (*Core) GetProjectDir ¶
Get the directory for the project with the given name.
func (*Core) GetProjectNames ¶
Get all the names of the projects.
func (*Core) GetProjects ¶
Get the projects from the projects.json file.
func (*Core) GetProjectsConfig ¶
Get the projects from the projects.json file.
func (*Core) ProjectExists ¶
Check if a project with the given name exists. Returns the project if it exists.
func (*Core) RemoveCommand ¶
Remove the command with the given name.
func (*Core) RemoveCommandFromProject ¶
Remove the command with the given commandName from the project with the given projectName.
func (*Core) RemoveDomainAlias ¶ added in v0.7.0
Remove a domain alias from the given project.
func (*Core) RemoveProject ¶
Remove the project with the given name.
func (*Core) RemoveVariable ¶
Remove the variable with the given key from the project with the given name.
func (*Core) RenameCommand ¶ added in v0.6.0
Rename the command with the given old name to the given new name.
func (*Core) RenameProject ¶ added in v0.6.0
Rename the project with the given old name to the given new name.
func (*Core) RequireSudo ¶
RequireSudo checks if the user has sudo permissions. This is needed to update some system files.
It returns an error if the user does not have sudo permissions.
func (*Core) SetProjectDir ¶
Set the directory for the project with the given name.
func (*Core) UpdateCommand ¶ added in v0.6.0
Update the command with the given name to the given command string.
type DomainAliases ¶ added in v0.7.1
type DomainAliases []string
DomainAliases is a map of domain aliases to their domain names.
type Project ¶
type Project struct {
Domain string `json:"domain"`
Port int `json:"port"`
Commands []string `json:"commands"`
Dir *string `json:"dir"`
Variables Variables `json:"variables"`
DomainAliases DomainAliases `json:"domainAliases"`
}
Project is a struct that represents a Project as stored in the projects.json file.