Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ the browser) edit the `ui:` options in place, comments kept.

A bad value keeps its default and is reported; an unknown key warns with a
"did you mean". One value where a list goes (`projects: ABC`) is a list of
one. An existing `~/.config/jiratui` or matterbox config (its `jira:` and
`ui:`) is picked up as a fallback.
one. An existing `~/.config/jiratui` config is picked up as a fallback.

## Jira

Expand Down
3 changes: 1 addition & 2 deletions docs/reference/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ issue's changelog shows someone else made: never on yours, and never on
their own writes coming back on the next refresh. A transition to the
status the issue has does nothing; one its workflow doesn't offer is logged.

A bad rule is skipped and reported. A matterbox config's `rules:` are
ignored.
A bad rule is skipped and reported.

## Watch a search

Expand Down
22 changes: 5 additions & 17 deletions internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Package config loads the Jira connection from
// ~/.config/laneway/config.yaml, falling back to the old jiratui name and
// then the jira: section of matterbox's config so an existing setup just works.
// ~/.config/laneway/config.yaml, falling back to the old jiratui name.
package config

import (
Expand All @@ -24,7 +23,7 @@ import (
"github.com/cornedor/laneway/internal/rules"
)

// JiraConfig is matterbox's jira: section.
// JiraConfig is the jira: section.
type JiraConfig struct {
// Name labels the default site (jira:) in the site pickers and the web
// header; sites: entries are labelled by their key.
Expand Down Expand Up @@ -461,7 +460,6 @@ func Load(path string) (Config, string, error) {
candidates = []string{
filepath.Join(d, "laneway", "config.yaml"),
filepath.Join(d, "jiratui", "config.yaml"),
filepath.Join(d, "matterbox", "config.yaml"),
}
}
for _, p := range candidates {
Expand All @@ -473,19 +471,9 @@ func Load(path string) (Config, string, error) {
return Config{}, p, err
}
var c Config
if filepath.Base(filepath.Dir(p)) == "matterbox" {
// Its rules: are chat rules; only jira: and ui: carry over.
var mb struct {
Jira JiraConfig `yaml:"jira"`
UI UIConfig `yaml:"ui"`
}
c.Warnings, err = decode(raw, &mb)
c.Jira, c.UI = mb.Jira, mb.UI
} else {
c.Warnings, err = decode(raw, &c)
c.Warnings = append(unknownKeys(raw), c.Warnings...)
c.Warnings = append(c.Warnings, people.Check(c.Jira.Pickers)...)
}
c.Warnings, err = decode(raw, &c)
c.Warnings = append(unknownKeys(raw), c.Warnings...)
c.Warnings = append(c.Warnings, people.Check(c.Jira.Pickers)...)
if err != nil {
return Config{}, p, fmt.Errorf("%s: %w", p, err)
}
Expand Down
15 changes: 0 additions & 15 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,6 @@ func TestLoadFallsBackToJiratui(t *testing.T) {
}
}

// TestMatterboxRulesIgnored: matterbox's rules: are chat rules, not ours.
func TestMatterboxRulesIgnored(t *testing.T) {
home := t.TempDir()
t.Setenv("XDG_CONFIG_HOME", home)
t.Setenv("HOME", home)
d, _ := os.UserConfigDir()
p := filepath.Join(d, "matterbox", "config.yaml")
_ = os.MkdirAll(filepath.Dir(p), 0o700)
_ = os.WriteFile(p, []byte("jira:\n base_url: https://x.test\nrules:\n - match: {channel: Ops, frequency: {count: 3}}\n actions: [{type: send, text: hi}]\n"), 0o600)
c, _, err := Load("")
if err != nil || c.Jira.BaseURL != "https://x.test" || c.Rules != nil {
t.Errorf("Load = %+v rules %v, %v", c.Jira, c.Rules, err)
}
}

func TestRequestTimeout(t *testing.T) {
for in, want := range map[string]time.Duration{"": 0, "45s": 45 * time.Second, " 1m ": time.Minute} {
if got, err := (JiraConfig{Timeout: in}).RequestTimeout(); err != nil || got != want {
Expand Down
3 changes: 1 addition & 2 deletions internal/i18n/nl/go-rest.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"commented": "reageerde",
"commit-msg: refuse keys Jira doesn't know": "commit-msg: weiger sleutels die Jira niet kent",
"config file": "configbestand",
"config file (default ~/.config/laneway/config.yaml, then jiratui's and matterbox's)": "configbestand (standaard ~/.config/laneway/config.yaml, dan die van jiratui en matterbox)",
"config file (default ~/.config/laneway/config.yaml, then jiratui's)": "configbestand (standaard ~/.config/laneway/config.yaml, dan die van jiratui)",
"config file to write (default ~/.config/laneway/config.yaml)": "configbestand om te schrijven (standaard ~/.config/laneway/config.yaml)",
"couldn't check %s: %v": "kon %s niet controleren: %v",
"create: %q is not safe to hand to a command": "create: %q is niet veilig om aan een commando mee te geven",
Expand Down Expand Up @@ -258,7 +258,6 @@
"summary can't be empty": "samenvatting mag niet leeg zijn",
"that agent is gone": "die agent is weg",
"the agent waits on an approval or question: answer it in its terminal": "de agent wacht op een goedkeuring of vraag: beantwoord die in zijn terminal",
"the config in use is matterbox's (%s), whose sites laneway doesn't read; copy its jira: to a laneway config (-config) first": "de gebruikte config is die van matterbox (%s), waarvan laneway de sites niet leest; kopieer de jira: eerst naar een laneway-config (-config)",
"the end must be a day after today": "het einde moet een dag na vandaag zijn",
"the file must be .woff2, .woff, .ttf or .otf": "het bestand moet .woff2, .woff, .ttf of .otf zijn",
"the keyring refused it (%s); keeping it in the file": "de sleutelhanger weigerde het (%s); het blijft in het bestand",
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var version = "dev"

func main() {
showVersion := flag.Bool("version", false, i18n.T("print the version and exit"))
cfgPath := flag.String("config", "", i18n.T("config file (default ~/.config/laneway/config.yaml, then jiratui's and matterbox's)"))
cfgPath := flag.String("config", "", i18n.T("config file (default ~/.config/laneway/config.yaml, then jiratui's)"))
site := flag.String("site", "", i18n.T("Jira site from the config's sites: (default the one last picked with @, else jira:)"))
demoFlag := flag.Bool("demo", false, i18n.T("try laneway on a generated project, without Jira; writes are kept in memory (-config: its ui: only)"))
flag.Parse()
Expand Down
4 changes: 0 additions & 4 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -146,9 +145,6 @@ func setupSite(ctx context.Context, cfgPath, site string, p prompter, verify fun
}
j.BaseURL = known.BaseURL
}
if filepath.Base(filepath.Dir(path)) == "matterbox" {
return "", fmt.Errorf(i18n.T("the config in use is matterbox's (%s), whose sites laneway doesn't read; copy its jira: to a laneway config (-config) first"), path)
}
first := errors.Is(err, config.ErrNoConfig) || cfg.Jira.BaseURL == "" && len(cfg.Sites) == 0
if first {
fmt.Fprintln(p.out, i18n.T("Connect laneway to a Jira site, or type demo to try it on a generated board first. ctrl+d cancels."))
Expand Down
Loading