config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config はアプリケーションの設定ファイル管理を担当します。

設定ファイルは ~/.config/ghs/config.toml に配置されることを想定しており、 Viper を介してロード・保存します。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir は ~/.config/ghs を返します。 XDG_CONFIG_HOME が設定されている場合はそれを優先します。

func ConfigFilePath

func ConfigFilePath() (string, error)

ConfigFilePath は設定ファイルの絶対パスを返します。

func EnsureConfigFile

func EnsureConfigFile() (string, error)

EnsureConfigFile は設定ファイルが存在しない場合に空のテンプレートを生成します。

Types

type Config

type Config struct {
	// GitHubToken は config.toml に保存された GitHub のアクセストークンです。
	// gh CLI から取得できない場合のフォールバックとして利用されます。
	GitHubToken string `mapstructure:"github_token"`

	// CloneBaseDir はクローン先のベースディレクトリです。
	// 未設定の場合は $HOME/ghs が使われます。
	CloneBaseDir string `mapstructure:"clone_base_dir"`
}

Config はアプリケーション全体の設定を保持する構造体です。

func Load

func Load() (*Config, error)

Load は設定ファイルを読み込み、 Config を返します。 設定ファイルが存在しない場合でもエラーにせず、デフォルト値を返します。

Jump to

Keyboard shortcuts

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