Documentation
¶
Overview ¶
Package utils
This package contains generic functions that are used in other packages.
Index ¶
- Constants
- func ConvertTemplateNameToFile(s string) string
- func FindImageExposedPorts(props FindImageExposedPortsProperty) []string
- func FindReferences(prop GoReferenceProperty, currentFileName, rootDir string) ([]protocol.Location, error)
- func FindSection(lines []string, lineNumber uint32) string
- func FirstCharacterToUpper(s string) string
- func ListQuadletFiles(ext, rootDir string, level int) ([]protocol.CompletionItem, error)
- func QuadletWalkDir(root string, level int, fn fs.WalkDirFunc) error
- func ReturnAsPtr[T any](s T) *T
- func ReturnAsStringPtr(s string) *string
- func ScanQadlet(text string, podmanVer PodmanVersion, properties map[ScanProperty]struct{}, ...) []protocol.Diagnostic
- type CommandExecutor
- type Commander
- type ContextMessenger
- type Documents
- type FindImageExposedPortsProperty
- type FindItemProperty
- type GoReferenceProperty
- type Messenger
- type MessengerLevel
- type PodmanVersion
- type ProjectProperty
- type QuadletConfig
- type QuadletLine
- type ScanProperty
Constants ¶
const ( MessengerDebug = iota MessengerInfo MessengerWarning MessengerError )
Variables ¶
This section is empty.
Functions ¶
func ConvertTemplateNameToFile ¶ added in v0.4.0
ConvertTemplateNameToFile Convert template name like 'web@siteA.container' to 'web@.container'
func FindImageExposedPorts ¶
func FindImageExposedPorts(props FindImageExposedPortsProperty) []string
FindImageExposedPorts This function looking around the current working directory and looking for references of the specified name
func FindReferences ¶ added in v0.7.0
func FindReferences(prop GoReferenceProperty, currentFileName, rootDir string) ([]protocol.Location, error)
FindReferences in other Quadlet files for the specific file
func FindSection ¶
FindSection This function looking for that the cursor currently in which section. Sections are like `[Container]`, `[Unit]`, and so on.
func FirstCharacterToUpper ¶
FirstCharacterToUpper makes the first character upper case
func ListQuadletFiles ¶
func ListQuadletFiles(ext, rootDir string, level int) ([]protocol.CompletionItem, error)
ListQuadletFiles List quadlet files from the current work directory based on extenstion
func QuadletWalkDir ¶ added in v0.7.0
func QuadletWalkDir(root string, level int, fn fs.WalkDirFunc) error
func ReturnAsPtr ¶ added in v0.7.0
func ReturnAsPtr[T any](s T) *T
ReturnAsPtr return with pointer of any type
func ReturnAsStringPtr ¶
ReturnAsStringPtr I did not find better solution, probably not nice but works
func ScanQadlet ¶ added in v0.3.0
func ScanQadlet( text string, podmanVer PodmanVersion, properties map[ScanProperty]struct{}, action func(q QuadletLine, p PodmanVersion, extraInfo any) []protocol.Diagnostic, extraInfo any, ) []protocol.Diagnostic
Types ¶
type CommandExecutor ¶
type CommandExecutor struct{}
type ContextMessenger ¶ added in v0.3.0
func (*ContextMessenger) SendMessage ¶ added in v0.3.0
func (m *ContextMessenger) SendMessage(level MessengerLevel, text string)
type Documents ¶
type Documents struct {
// contains filtered or unexported fields
}
func NewDocuments ¶
func NewDocuments() Documents
func (*Documents) ListFileNames ¶
type FindImageExposedPortsProperty ¶ added in v0.7.0
type FindItemProperty ¶ added in v0.5.0
type FindItemProperty struct {
URI string // URI that is passed from editor
RootDirectory string // Workspace root directory
Text string // Text of the current document
Section string // Section we are looking for
Property string // Property we are looking for within the section
DirLevel int // How deep we want to search
}
FindItemProperty Parameter of FindItems() function.
type GoReferenceProperty ¶ added in v0.7.0
type Messenger ¶ added in v0.3.0
type Messenger interface {
SendMessage(level MessengerLevel, text string)
}
type MessengerLevel ¶ added in v0.3.0
type MessengerLevel int
type PodmanVersion ¶
func BuildPodmanVersion ¶
func BuildPodmanVersion(version, release, minor int) PodmanVersion
func NewPodmanVersion ¶
func NewPodmanVersion(c Commander) (PodmanVersion, error)
func ParseVersion ¶
func ParseVersion(raw string) (PodmanVersion, error)
func (PodmanVersion) GreaterOrEqual ¶
func (p PodmanVersion) GreaterOrEqual(other PodmanVersion) bool
func (PodmanVersion) IsSupported ¶
func (p PodmanVersion) IsSupported() bool
type ProjectProperty ¶ added in v0.7.0
type QuadletConfig ¶
type QuadletConfig struct {
Mu sync.RWMutex `json:"-"`
Disable []string `json:"disable"`
PodmanVersion string `json:"podmanVersion"`
Project ProjectProperty `json:"project"`
Podman PodmanVersion `json:"-"`
WorkspaceRoot string `json:"-"`
}
func LoadConfig ¶
func LoadConfig(workspaceRoot string, c Commander) (*QuadletConfig, error)
type QuadletLine ¶
type QuadletLine struct {
LineNumber uint32
Length uint32
Property string
Value string
RawLine string
Section string
FilePath string
}
func FindItems ¶
func FindItems(params FindItemProperty) []QuadletLine
FindItems This function scanning the passed text and looking for property in specific section.