Documentation
¶
Index ¶
- Variables
- func CloseGormDB() error
- func EnsureDir(path string) error
- func FileExists(path string) bool
- func GetDefaultConfig() *models.AppConfig
- func GetExeDir() string
- func GetGitRoot() (string, error)
- func GetGormDB() (*gorm.DB, error)
- func GetProjectRoot() (string, error)
- func HideWindow(cmd *exec.Cmd) *exec.Cmd
- func InitAppDirs() error
- func InitDataDirs() error
- func IsPathWithin(child, parent string) bool
- func MigratePathsIfNeeded()
- func OutputJSON(v any)
- func OutputJSONL(items any)
- type Config
- func (c *Config) ApplyConfig(appConfig *models.AppConfig)
- func (c *Config) GetAppDir() string
- func (c *Config) GetAppSeriesDir() string
- func (c *Config) GetConfigDir() string
- func (c *Config) GetConfigPath() string
- func (c *Config) GetDbDir() string
- func (c *Config) GetDbPath() string
- func (c *Config) GetHomeDir() string
- func (c *Config) GetLocalWikiDir() string
- func (c *Config) GetLogDir() string
- func (c *Config) GetLogPath() string
- func (c *Config) GetReposDir() string
- func (c *Config) GetReposDirFromConfig(appConfig *models.AppConfig) string
- func (c *Config) GetWikiDir() string
- func (c *Config) LoadConfig() *models.AppConfig
- func (c *Config) SaveConfig(config *models.AppConfig) error
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigInstance = Config{}
Functions ¶
func CloseGormDB ¶
func CloseGormDB() error
func FileExists ¶
func GetGitRoot ¶ added in v0.0.9
func GetProjectRoot ¶
func HideWindow ¶ added in v0.0.9
HideWindow 在非 Windows 平台为 no-op——控制台窗口闪烁是 Windows GUI 子系统 特有的问题,Unix 平台无此概念。保留同名函数使调用方无需按平台分支。
func InitAppDirs ¶
func InitAppDirs() error
func InitDataDirs ¶ added in v0.0.3
func InitDataDirs() error
func IsPathWithin ¶ added in v0.0.9
IsPathWithin reports whether `child` is the same as or inside `parent`. It uses filepath.Rel to correctly reject prefix-lookalikes (e.g. parent="/a/repo", child="/a/repo-evil" → false), which a naive strings.HasPrefix check would wrongly accept.
Both paths are cleaned first. Symlinks are NOT resolved — callers that need symlink-safe checks should filepath.EvalSymlinks first.
func MigratePathsIfNeeded ¶ added in v0.0.3
func MigratePathsIfNeeded()
func OutputJSON ¶
func OutputJSON(v any)
func OutputJSONL ¶
func OutputJSONL(items any)
Types ¶
type Config ¶
type Config struct {
HomeDir string
AppSeriesDir string
AppDir string
ConfigDir string
ConfigPath string
DbDir string
DbPath string
LogDir string
LogPath string
ReposDir string
WikiDir string
}
func (*Config) ApplyConfig ¶
func (*Config) GetAppSeriesDir ¶
func (*Config) GetConfigDir ¶
func (*Config) GetConfigPath ¶
func (*Config) GetHomeDir ¶
func (*Config) GetLocalWikiDir ¶ added in v0.0.8
func (*Config) GetLogPath ¶
func (*Config) GetReposDir ¶
func (*Config) GetReposDirFromConfig ¶
func (*Config) GetWikiDir ¶
func (*Config) LoadConfig ¶
type OutputFormat ¶
type OutputFormat string
const ( FormatTable OutputFormat = "table" FormatJSON OutputFormat = "json" FormatJSONL OutputFormat = "jsonl" )
func ParseFormat ¶
func ParseFormat(s string) OutputFormat
Click to show internal directories.
Click to hide internal directories.