config

package
v0.0.0-...-fe515d1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileNameCred : 資格情報のファイル名
	FileNameCred = ".credentials.toml"
	// FileNamePref: 環境設定のファイル名
	FileNamePref = "preferences.toml"
)
View Source
const (
	// アプリ全体のアクション
	ActionQuit = "quit"

	// ページビューのアクション
	ActionSelectPrevTab = "select_prev_tab"
	ActionSelectNextTab = "select_next_tab"
	ActionClosePage     = "close_page"
	ActionRedraw        = "redraw"
	ActionFocusCmdLine  = "focus_cmdline"
	ActionShowHelp      = "show_help"

	// ページ共通のアクション
	ActionReloadPage = "reload_page"

	// 投稿一覧のアクション
	ActionScrollUp      = "scroll_up"
	ActionScrollDown    = "scroll_down"
	ActionCursorUp      = "cursor_up"
	ActionCursorDown    = "cursor_down"
	ActionCursorTop     = "cursor_top"
	ActionCursorBottom  = "cursor_bottom"
	ActionPost          = "post"
	ActionReaction      = "reaction"
	ActionUnreaction    = "unreaction"
	ActionRepost        = "repost"
	ActionUnrepost      = "unrepost"
	ActionDelete        = "delete"
	ActionBookmark      = "bookmark"
	ActionUnbookmark    = "unbookmark"
	ActionReply         = "reply"
	ActionOpenBrowser   = "open_browser"
	ActionOpenUserPage  = "open_user"
	ActionCopyUrl       = "copy_url"
	ActionFollow        = "follow"
	ActionUnfollow      = "unfollow"
	ActionBlock         = "block"
	ActionUnblock       = "unblock"
	ActionMute          = "mute"
	ActionUnmute        = "unmute"
	ActionOpenReactions = "open_reactions"
)
View Source
const PreferencesVersion = 1

Variables

This section is empty.

Functions

func GetConfigFileNames

func GetConfigFileNames() ([]string, error)

GetConfigFileNames : 設定ディレクトリ以下のファイル名を取得

Types

type AppStyle

type AppStyle struct {
	BackgroundColor color  `toml:"background_color"`
	BorderColor     color  `toml:"border_color"`
	TextColor       color  `toml:"text_color"`
	SubTextColor    color  `toml:"sub_text_color"`
	EmphasisText    string `toml:"emphasis_text"`
}

AppStyle : アプリ全体のスタイル

type Appearance

type Appearance struct {
	// StylePath : 配色テーマファイルのパス
	StylePath string `toml:"style_path"`
	// FormatDate : 日付のフォーマット
	FormatDate string `toml:"format_date"`
	// FormatTime : 時刻のフォーマット
	FormatTime string `toml:"format_time"`
	// UserBIOMaxRow : ユーザBIOの最大表示行数
	UserBIOMaxRow int `toml:"user_bio_max_row"`
	// UserDetailSeparator : ユーザ詳細のセパレータ
	UserDetailSeparator string `toml:"user_detail_separator"`
	// PostSeparator : 投稿のセパレータ
	PostSeparator string `toml:"post_separator"`
	// HidePostSeparator : 投稿間のセパレータを非表示
	HidePostSeparator bool `toml:"hide_post_separator"`
	// GraphChar : 投票グラフの表示に使用する文字
	GraphChar string `toml:"graph_char"`
	// GraphMaxWidth : 投票グラフの最大表示幅
	GraphMaxWidth int `toml:"graph_max_width"`
	// TabSeparator : タブのセパレータ
	TabSeparator string `toml:"tab_separator"`
	// TabMaxWidth : タブの最大表示幅
	TabMaxWidth int `toml:"tab_max_width"`
}

Appearance : 外観

type AutocompleteStyle

type AutocompleteStyle struct {
	TextColor               color `toml:"text_color"`
	BackgroundColor         color `toml:"background_color"`
	SelectedBackgroundColor color `toml:"selected_background_color"`
}

AutocompleteStyle : 補完候補のスタイル

type Config

type Config struct {
	// Cred : 資格情報
	Creds *Credential
	// Pref : 環境設定
	Pref *Preferences
	// Style : スタイル定義
	Style *Style
	// DirPath : 設定ディレクトリのパス
	DirPath string
}

Config : 設定

func New

func New() (*Config, error)

func (*Config) LoadCred

func (c *Config) LoadCred() error

LoadCred : 資格情報を読込む

func (*Config) LoadPreferences

func (c *Config) LoadPreferences() error

LoadPreferences : 環境設定を読込む

func (*Config) LoadStyle

func (c *Config) LoadStyle() error

LoadStyle : スタイル定義を読込む

func (*Config) SaveAll

func (c *Config) SaveAll() error

SaveAll : 一括保存

func (*Config) SaveCred

func (c *Config) SaveCred() error

SaveCred : 資格情報を保存

func (*Config) SavePreferences

func (c *Config) SavePreferences() error

SavePreferences : 環境設定を保存

type Credential

type Credential struct {
	// Clients : クライアント
	Clients map[string]*sharedapi.ClientCredential `toml:"clients"`
	// Users : ユーザー
	Users map[string]*sharedapi.UserCredential `toml:"users"`
}

Credential : 資格情報

func (*Credential) AddClient

func (c *Credential) AddClient(server string, cred *sharedapi.ClientCredential)

AddClient : クライアントの資格情報を追加

func (*Credential) AddUser

func (c *Credential) AddUser(username string, cred *sharedapi.UserCredential)

AddUser : ユーザーの資格情報を追加

func (*Credential) DeleteUser

func (c *Credential) DeleteUser(username string) error

DeleteUser : ユーザーの資格情報を削除

func (*Credential) GetAllUsernames

func (c *Credential) GetAllUsernames() []string

GetAllUsernames : 全てのユーザ名を取得

func (*Credential) GetClient

func (c *Credential) GetClient(server string) (*sharedapi.ClientCredential, error)

GetClient : クライアントの資格情報を取得

func (*Credential) GetUser

func (c *Credential) GetUser(username string) (*sharedapi.UserCredential, error)

GetUser : ユーザーの資格情報を取得

type Feature

type Feature struct {
	// MainAccount : メインで使用するアカウント
	MainAccount string `toml:"main_account"`
	// LoadPostCount : 1度に読み込む投稿数
	LoadPostCount int `toml:"load_post_count"`
	// MaxPostCount : 投稿の最大蓄積数
	MaxPostCount int `toml:"max_post_count"`
	// IsLocaleCJK : ロケールがCJKか
	IsLocaleCJK bool `toml:"is_locale_cjk"`
	// StartupCmds : 起動時に実行するコマンド
	StartupCmds []string `toml:"startup_cmds"`
}

Feature : 機能

type Keybindings

type Keybindings struct {
	// Global : アプリ全体のキーバインド
	Global keybinding `toml:"global"`
	// View : メインビューのキーバインド
	View keybinding `toml:"view"`
	// Page : ページ共通のキーバインド
	Page keybinding `toml:"page"`
	// Posts : 投稿一覧のキーバインド
	Posts keybinding `toml:"posts"`
	// User : ユーザーページのキーバインド
	User keybinding `toml:"user"`
}

Keybindings : キーバインド

type MetricsStyle

type MetricsStyle struct {
	PostsText                string `toml:"posts_text"`
	PostsBackgroundColor     color  `toml:"posts_background_color"`
	FollowingText            string `toml:"following_text"`
	FollowingBackgroundColor color  `toml:"following_background_color"`
	FollowersText            string `toml:"followers_text"`
	FollowersBackgroundColor color  `toml:"followers_background_color"`
}

MetricsStyle : ユーザメトリクスのスタイル

type PostStyle

type PostStyle struct {
	Annotation string `toml:"annotation"`
	Detail     string `toml:"detail"`
	Like       string `toml:"like"`
	Liked      string `toml:"liked"`
	Repost     string `toml:"repost"`
	Reposted   string `toml:"reposted"`
	Bookmarked string `toml:"bookmarked"`
	HashTag    string `toml:"hashtag"`
	Mention    string `toml:"mention"`
	PollGraph  string `toml:"poll_graph"`
	PollDetail string `toml:"poll_detail"`
	Separator  string `toml:"separator"`
}

PostStyle : 投稿のスタイル

type Preferences

type Preferences struct {
	Version     int             `toml:"version"`
	Feature     Feature         `toml:"feature"`
	Confirm     map[string]bool `toml:"comfirm"`
	Appearance  Appearance      `toml:"appearance"`
	Template    Template        `toml:"template"`
	Text        Text            `toml:"text"`
	Keybindings Keybindings     `toml:"keybinding"`
}

Preferences : 環境設定

type StatusBarStyle

type StatusBarStyle struct {
	Text            string `toml:"text"`
	BackgroundColor color  `toml:"background_color"`
}

StatusBarStyle : ステータスバーのスタイル

type Style

type Style struct {
	App          AppStyle          `toml:"app"`
	Tab          TabStyle          `toml:"tab"`
	Autocomplate AutocompleteStyle `toml:"autocomplete"`
	StatusBar    StatusBarStyle    `toml:"statusbar"`
	Post         PostStyle         `toml:"post"`
	User         UserStyle         `toml:"user"`
	Metrics      MetricsStyle      `toml:"metrics"`
}

Style : スタイル定義

type TabStyle

type TabStyle struct {
	Text            string `toml:"text"`
	BackgroundColor color  `toml:"background_color"`
}

TabStyle : タブのスタイル

type Template

type Template struct {
	// Post : 投稿
	Post string `toml:"post"`
	// PostAnnotation : 投稿のアノテーション
	PostAnnotation string `toml:"post_annotation"`
	// PostDetail : 投稿詳細
	PostDetail string `toml:"post_detail"`
	// PostPoll : 投票
	PostPoll string `toml:"post_poll"`
	// PostPollGraph : 投票グラフ
	PostPollGraph string `toml:"post_poll_graph"`
	// PostPollDetail : 投票詳細
	PostPollDetail string `toml:"post_poll_detail"`
	// User : ユーザ
	User string `toml:"user"`
	// UserDetail : ユーザ詳細
	UserDetail string `toml:"user_detail"`
	// TabHome : ホームタイムラインタブ
	TabHome string `toml:"tab_home"`
	// TabGlobal : グローバスタイムラインタブ
	TabGlobal string `toml:"tab_global"`
	// TabLocal : ローカルタイムラインタブ
	TabLocal string `toml:"tab_local"`
	// TabList : リストタブ
	TabList string `toml:"tab_list"`
	// TabMention : メンションタブ
	TabMention string `toml:"tab_mention"`
	// TabBookmarks : ブックマークタブ
	TabBookmarks string `toml:"tab_bookmark"`
	// TabUser : ユーザタブ
	TabUser string `toml:"tab_user"`
	// TabSearch : 検索タブ
	TabSearch string `toml:"tab_search"`
	// TabReactions : いいねタブ
	TabReactions string `toml:"tab_reactions"`
	// TabAnnouncements : アナウンスタブ
	TabAnnouncements string `toml:"announcements"`
	// TabDocument : ドキュメントタブ
	TabDocument string `toml:"tab_document"`
}

Template : 表示テンプレート

type Text

type Text struct {
	// Geo : 位置情報
	Geo string `toml:"geo"`
	// Link : リンク
	Link string `toml:"link"`
	// Pinned : ピン留め
	Pinned string `toml:"pinned"`
	// Verified : 認証バッジ
	Verified string `toml:"verified"`
	// Private : 非公開バッジ
	Private string `toml:"private"`
	// Bookmarked : ブックマーク済み
	Bookmarked string `toml:"bookmarked"`
	// Reaction : リアクション数
	Reaction string `toml:"reaction"`
	// Repost : リポスト数
	Repost string `toml:"repost"`
	// Loading : 読み込み中
	Loading string `toml:"loading"`
	// NoPosts : 投稿なし
	NoPosts string `toml:"no_posts"`
}

Text : 表示テキスト

type UserStyle

type UserStyle struct {
	Name     string `toml:"name"`
	UserName string `toml:"user_name"`
	Detail   string `toml:"detail"`
	Verified string `toml:"verified"`
	Private  string `toml:"private"`
}

UserStyle : ユーザのスタイル

Jump to

Keyboard shortcuts

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