refactor(config)!: moved store.list_all_stores to list.list_all_stores
This commit is contained in:
parent
d992074c9c
commit
df70be2c4f
6 changed files with 42 additions and 11 deletions
|
|
@ -35,6 +35,7 @@ type Config struct {
|
|||
DisplayAsciiArt bool `toml:"display_ascii_art"`
|
||||
Key KeyConfig `toml:"key"`
|
||||
Store StoreConfig `toml:"store"`
|
||||
List ListConfig `toml:"list"`
|
||||
Git GitConfig `toml:"git"`
|
||||
}
|
||||
|
||||
|
|
@ -46,11 +47,15 @@ type KeyConfig struct {
|
|||
|
||||
type StoreConfig struct {
|
||||
DefaultStoreName string `toml:"default_store_name"`
|
||||
ListAllStores bool `toml:"list_all_stores"`
|
||||
AlwaysPromptDelete bool `toml:"always_prompt_delete"`
|
||||
AlwaysPromptOverwrite bool `toml:"always_prompt_overwrite"`
|
||||
}
|
||||
|
||||
type ListConfig struct {
|
||||
ListAllStores bool `toml:"list_all_stores"`
|
||||
DefaultListFormat string `toml:"default_list_format"`
|
||||
}
|
||||
|
||||
type GitConfig struct {
|
||||
AutoFetch bool `toml:"auto_fetch"`
|
||||
AutoCommit bool `toml:"auto_commit"`
|
||||
|
|
@ -85,10 +90,13 @@ func defaultConfig() Config {
|
|||
},
|
||||
Store: StoreConfig{
|
||||
DefaultStoreName: "default",
|
||||
ListAllStores: true,
|
||||
AlwaysPromptDelete: true,
|
||||
AlwaysPromptOverwrite: true,
|
||||
},
|
||||
List: ListConfig{
|
||||
ListAllStores: true,
|
||||
DefaultListFormat: "table",
|
||||
},
|
||||
Git: GitConfig{
|
||||
AutoFetch: false,
|
||||
AutoCommit: false,
|
||||
|
|
@ -121,6 +129,13 @@ func loadConfig() (Config, error) {
|
|||
cfg.Store.DefaultStoreName = defaultConfig().Store.DefaultStoreName
|
||||
}
|
||||
|
||||
if cfg.List.DefaultListFormat == "" {
|
||||
cfg.List.DefaultListFormat = defaultConfig().List.DefaultListFormat
|
||||
}
|
||||
if err := validListFormat(cfg.List.DefaultListFormat); err != nil {
|
||||
return cfg, fmt.Errorf("parse %s: list.default_list_format: %w", path, err)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue