aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-26 10:31:30 +0000
committerFuwn <[email protected]>2026-01-26 10:31:35 +0000
commit7ed8407a61fd040012b0ccf148c88ea3ef85f99c (patch)
tree8a6125719623198037f32b4d33ea3e6b349c7cf4 /cmd
parentdocs(README): Add naming wink (diff)
downloadmugi-7ed8407a61fd040012b0ccf148c88ea3ef85f99c.tar.xz
mugi-7ed8407a61fd040012b0ccf148c88ea3ef85f99c.zip
feat(config): Add config-based defaults for verbosity and remotes
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mugi/main.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/mugi/main.go b/cmd/mugi/main.go
index 76f1c18..3c32db6 100644
--- a/cmd/mugi/main.go
+++ b/cmd/mugi/main.go
@@ -41,6 +41,8 @@ func run() error {
return fmt.Errorf("config: %w", err)
}
+ applyDefaults(&cmd, cfg)
+
tasks := ui.BuildTasks(cfg, cmd.Repo, cmd.Remotes)
if len(tasks) == 0 {
return fmt.Errorf("no matching repositories or remotes found")
@@ -48,3 +50,21 @@ func run() error {
return ui.Run(cmd.Operation, tasks, cmd.Verbose, cmd.Force, cmd.Linear)
}
+
+func applyDefaults(cmd *cli.Command, cfg config.Config) {
+ if cfg.Defaults.Verbose {
+ cmd.Verbose = true
+ }
+
+ if cfg.Defaults.Linear {
+ cmd.Linear = true
+ }
+
+ if len(cmd.Remotes) == 1 && cmd.Remotes[0] == "all" {
+ opRemotes := cfg.Defaults.RemotesFor(cmd.Operation.String())
+
+ if len(opRemotes) > 0 {
+ cmd.Remotes = opRemotes
+ }
+ }
+}