common

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package common contains common functions used throughout the cli commands. Functions like display.s, CreateFileWithContent and GetEnvDir

Index

Constants

This section is empty.

Variables

View Source
var ErrImageMissing = errors.New("image not found locally")
View Source
var Version = "dev"

Functions

func BuildEnvPath

func BuildEnvPath(customPath, name, prefix string) (string, error)

BuildEnvPath constructs the environment directory path

func CheckEnvForUpdates added in v0.9.0

func CheckEnvForUpdates(envFile string) ([]display.ImageUpdateInfo, error)

func Confirm added in v0.7.0

func Confirm(prompt string) (bool, error)

func CopyDir

func CopyDir(src, dst string) error

CopyDir recursively copies a directory from src to dst

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst

func CreateFileWithContent

func CreateFileWithContent(filePath, content string) error

CreateFileWithContent creates a file with given content

func CreateTmpCopy

func CreateTmpCopy(dir string) (string, error)

CreateTmpCopy creates a backup copy of the environment directory in a temporary location

func DeleteEnvDir

func DeleteEnvDir(path string) error

func Export

func Export(path, filename string, content []byte) error

func FindFreePort added in v0.2.0

func FindFreePort() (int, error)

func GenerateExportHeader added in v0.7.0

func GenerateExportHeader() string

GenerateExportHeader returns a standardized header for exported files

func GetContentFromPathOrDefault

func GetContentFromPathOrDefault(filePath, defaultContent string) (string, error)

GetContentFromPathOrDefault reads content from filePath if provided, otherwise returns defaultContent

func GetLocalIP

func GetLocalIP() (string, error)

func GetVersion added in v0.7.0

func GetVersion() string

GetVersion returns the version of the CLI

func IsPortFree added in v0.2.0

func IsPortFree(port int) (bool, error)

func PopulateEnv added in v0.5.0

func PopulateEnv(ttlPath, endpointURL string, parallel int) error

PopulateEnv ingests TTL (Turtle) files into an environment by posting them to the gatewey endpoint. It accepts either a single file or a directory path. When given a directory, it recursively walks through all subdirectories and ingests all *.ttl files found, processing them in parallel according to the specified concurrency limit.

Parameters:

  • ttlPath: Path to a TTL file or directory containing TTL files
  • gatewayURL: Base URL of the EPOS gateway (e.g., "https://gateway.example.com")
  • parallel: Maximum number of concurrent file ingestions (use 1 for sequential processing)

Returns an error if any file fails to ingest or if the path is invalid.

func PopulateExample added in v0.5.0

func PopulateExample(endpointURL string, parallel int) error

func PopulateOntologies

func PopulateOntologies(baseURL string) error

PopulateOntologies populates an environment deployed in a dir with the base ontologies for the ingestor

func RemoveEnvDir

func RemoveEnvDir(dir string) error

RemoveEnvDir deletes the environment directory with logs

func RemoveTmpDir

func RemoveTmpDir(tmpDir string) error

RemoveTmpDir removes the temporary backup directory with logs

func RestoreTmpDir

func RestoreTmpDir(tmpDir, targetDir string) error

RestoreTmpDir restores the environment from temporary backup to target directory

Types

This section is empty.

Jump to

Keyboard shortcuts

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