config

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileNameCred : 認証情報のファイル名
	FileNameCred = ".cred.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"

	// ホームタイムラインページのアクション
	ActionStreamModeStart = "stream_mode_start"
	ActionStreamModeStop  = "stream_mode_stop"

	// ツイートビューのアクション
	ActionScrollUp       = "scroll_up"
	ActionScrollDown     = "scroll_down"
	ActionCursorUp       = "cursor_up"
	ActionCursorDown     = "cursor_down"
	ActionCursorTop      = "cursor_top"
	ActionCursorBottom   = "cursor_bottom"
	ActionTweetLike      = "tweet_like"
	ActionTweetUnlike    = "tweet_unlike"
	ActionTweetRetweet   = "tweet_retweet"
	ActionTweetUnretweet = "tweet_unretweet"
	ActionTweetDelete    = "tweet_delete"
	ActionUserFollow     = "user_follow"
	ActionUserUnfollow   = "user_unfollow"
	ActionUserBlock      = "user_block"
	ActionUserUnblock    = "user_unblock"
	ActionUserMute       = "user_mute"
	ActionUserUnmute     = "user_unmute"
	ActionOpenUserPage   = "open_user_page"
	ActionOpenUserLikes  = "open_user_likes"
	ActionTweet          = "tweet"
	ActionQuote          = "quote"
	ActionReply          = "reply"
	ActionOpenBrowser    = "open_browser"
	ActionCopyUrl        = "copy_url"
)

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 Appearancene

type Appearancene struct {
	// StyleFilePath : 配色テーマファイルのパス
	StyleFilePath string `toml:"style_file"`
	// DateFormat : 日付のフォーマット
	DateFormat string `toml:"date_fmt"`
	// TimeFormat : 時刻のフォーマット
	TimeFormat string `toml:"time_fmt"`
	// UserBIOMaxRow : ユーザBIOの最大表示行数
	UserBIOMaxRow int `toml:"user_bio_max_row"`
	// UserProfilePaddingX : ユーザプロフィールの左右パディング
	UserProfilePaddingX int `toml:"user_profile_padding_x"`
	// UserDetailSeparator : ユーザ詳細のセパレータ
	UserDetailSeparator string `toml:"user_detail_separator"`
	// HideTweetSeparator : ツイート間のセパレータを非表示
	HideTweetSeparator bool `toml:"hide_tweet_separator"`
	// HideQuoteTweetSeparator : 引用ツイートのセパレータを非表示
	HideQuoteTweetSeparator bool `toml:"hide_quote_tweet_separator"`
	// TweetSeparator : ツイートのセパレータ
	TweetSeparator string `toml:"tweet_separator"`
	// QuoteTweetSeparator : 引用ツイートのセパレータ
	QuoteTweetSeparator string `toml:"quote_tweet_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"`
}

Appearancene : 外観

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 : 認証情報
	Cred *Cred
	// Pref : 環境設定
	Pref *Preferences
	// Style : スタイル定義
	Style *Style
	// DirPath : 設定ディレクトリのパス
	DirPath string
}

Config : 設定

func New

func New() *Config

New : 新規作成

func (*Config) CheckOldFile

func (c *Config) CheckOldFile()

CheckOldFile : 古い設定ファイルがあるかチェック

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 Cred

type Cred struct {
	Consumer oauth1.Token `toml:"consumer"`
	User     User         `toml:"user"`
}

Cred : 認証情報

func (*Cred) Delete

func (c *Cred) Delete(userName string) error

Delete : 削除

func (*Cred) Get

func (c *Cred) Get(userName string) (*api.User, error)

Get : 取得

func (*Cred) GetAllNames

func (c *Cred) GetAllNames() []string

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

func (*Cred) Write

func (c *Cred) Write(newUser *api.User)

Write : 書込む

type Feature

type Feature struct {
	// MainUser : メインで使用するユーザ
	MainUser string `toml:"main_user"`
	// LoadTweetsLimit : 1度に読み込むツイート数
	LoadTweetsLimit int `toml:"load_tweets_limit"`
	// AccmulateTweetsLimit : ツイートの最大蓄積数
	AccmulateTweetsLimit int `toml:"accmulate_tweets_limit"`
	// UseExternalEditor : ツイート編集に外部エディタを使用するか
	UseExternalEditor bool `toml:"use_external_editor"`
	// IsLocaleCJK : ロケールがCJKか
	IsLocaleCJK bool `toml:"is_locale_cjk"`
	// StartupCmds : 起動時に実行するコマンド
	StartupCmds []string `toml:"startup_cmds"`
}

Feature : 機能

type Icon

type Icon 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"`
}

Icon : アイコン

type Keybindings

type Keybindings struct {
	// Global : アプリ全体のキーバインド
	Global keybinding `toml:"global"`
	// View : メインビューのキーバインド
	View keybinding `toml:"view"`
	// Page : ページ共通のキーバインド
	Page keybinding `toml:"page"`
	// HomeTimeline : ホームタイムラインページのキーバインド
	HomeTimeline keybinding `toml:"home_timeline"`
	// TweetView : ツイートビューのキーバインド
	TweetView keybinding `toml:"tweet"`
}

Keybindings : キーバインド

type Layout

type Layout struct {
	// Tweet : ツイート
	Tweet string `toml:"tweet"`
	// TweetAnotation : ツイートアノテーション
	TweetAnotation string `toml:"tweet_anotation"`
	// TweetDetail : ツイート詳細
	TweetDetail string `toml:"tweet_detail"`
	// TweetPoll : 投票
	TweetPoll string `toml:"tweet_poll"`
	// TweetPollGraph : 投票グラフ
	TweetPollGraph string `toml:"tweet_poll_graph"`
	// TweetPollDetail : 投票詳細
	TweetPollDetail string `toml:"tweet_poll_detail"`
	// User : ユーザプロフィール
	User string `toml:"user"`
	// UserInfo : ユーザ情報
	UserInfo string `toml:"user_info"`
}

Layout : 表示レイアウト

type MetricsStyle

type MetricsStyle struct {
	TweetsText               string `toml:"tweets_text"`
	TweetsBackgroundColor    color  `toml:"tweets_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 Preferences

type Preferences struct {
	Feature     Feature         `toml:"feature"`
	Confirm     map[string]bool `toml:"comfirm"`
	Appearance  Appearancene    `toml:"appearance"`
	Layout      Layout          `toml:"layout"`
	Text        Text            `toml:"text"`
	Icon        Icon            `toml:"icon"`
	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"`
	Tweet        TweetStyle        `toml:"tweet"`
	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 Text

type Text struct {
	// Like : いいねの単位
	Like string `toml:"like"`
	// Retweet : リツイートの単位
	Retweet string `toml:"retweet"`
	// Loading : 読み込み中
	Loading string `toml:"loading"`
	// NoTweets : ツイート無し
	NoTweets string `toml:"no_tweets"`
	// TweetTextAreaHint : ツイートエリアのヒント
	TweetTextAreaHint string `toml:"tweet_textarea_hint"`
	// TabHome : ホームタブ
	TabHome string `toml:"tab_home"`
	// TabMention : メンションタブ
	TabMention string `toml:"tab_mention"`
	// TabList : リストタブ
	TabList string `toml:"tab_list"`
	// TabUser : ユーザタブ
	TabUser string `toml:"tab_user"`
	// TabSearch : 検索タブ
	TabSearch string `toml:"tab_search"`
	// TabLikes : いいねリストタブ
	TabLikes string `toml:"tab_likes"`
	// TabDocs : ドキュメントタブ
	TabDocs string `toml:"tab_docs"`
}

Text : 表示テキスト

type TweetStyle

type TweetStyle struct {
	Annotation string `toml:"annotation"`
	Detail     string `toml:"detail"`
	Like       string `toml:"like"`
	Retweet    string `toml:"retweet"`
	HashTag    string `toml:"hashtag"`
	Mention    string `toml:"mention"`
	PollGraph  string `toml:"poll_graph"`
	PollDetail string `toml:"poll_detail"`
	Separator  string `toml:"separator"`
}

TweetStyle : ツイートのスタイル

type User

type User struct {
	Accounts []api.User `toml:"accounts"`
}

User : ユーザの認証情報

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