feat: bundle Terebi Sunset as a selectable local theme
This commit is contained in:
@@ -51,18 +51,20 @@ func currentScheme() (tintyScheme, error) {
|
||||
if err != nil {
|
||||
return tintyScheme{}, err
|
||||
}
|
||||
output, err := exec.Command("tinty", "list", "--json").Output()
|
||||
if err != nil {
|
||||
return tintyScheme{}, err
|
||||
}
|
||||
var schemes []tintyScheme
|
||||
if err := json.Unmarshal(output, &schemes); err != nil {
|
||||
return tintyScheme{}, err
|
||||
}
|
||||
id := strings.TrimSpace(string(current))
|
||||
for _, scheme := range schemes {
|
||||
if scheme.ID == id {
|
||||
return scheme, nil
|
||||
for _, args := range [][]string{{"list", "--json"}, {"list", "--json", "--custom-schemes"}} {
|
||||
output, err := exec.Command("tinty", args...).Output()
|
||||
if err != nil {
|
||||
return tintyScheme{}, err
|
||||
}
|
||||
var schemes []tintyScheme
|
||||
if err := json.Unmarshal(output, &schemes); err != nil {
|
||||
return tintyScheme{}, err
|
||||
}
|
||||
for _, scheme := range schemes {
|
||||
if scheme.ID == id {
|
||||
return scheme, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return tintyScheme{}, fmt.Errorf("scheme not found: %s", id)
|
||||
|
||||
Reference in New Issue
Block a user