summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-08-12 16:52:40 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-08-12 16:52:40 +1000
commitb1bc437d1b91b33c767a31be15f8f41e90c4d8f0 (patch)
treed292354b922f247cef4035d2c7699f8e0b7f0f92 /pkg
parent26989ce0eecbb8509c6951d5d427913498a0d58f (diff)
Factor out common config setup functions in demo package
Diffstat (limited to 'pkg')
-rw-r--r--pkg/integration/tests/demo/amend_old_commit.go2
-rw-r--r--pkg/integration/tests/demo/bisect.go2
-rw-r--r--pkg/integration/tests/demo/cherry_pick.go2
-rw-r--r--pkg/integration/tests/demo/commit_and_push.go2
-rw-r--r--pkg/integration/tests/demo/commit_graph.go10
-rw-r--r--pkg/integration/tests/demo/custom_command.go4
-rw-r--r--pkg/integration/tests/demo/custom_patch.go2
-rw-r--r--pkg/integration/tests/demo/filter.go2
-rw-r--r--pkg/integration/tests/demo/interactive_rebase.go2
-rw-r--r--pkg/integration/tests/demo/nuke_working_tree.go2
-rw-r--r--pkg/integration/tests/demo/rebase_onto.go2
-rw-r--r--pkg/integration/tests/demo/shared.go19
-rw-r--r--pkg/integration/tests/demo/stage_lines.go2
-rw-r--r--pkg/integration/tests/demo/undo.go2
-rw-r--r--pkg/integration/tests/demo/worktree_create_from_branches.go4
15 files changed, 34 insertions, 25 deletions
diff --git a/pkg/integration/tests/demo/amend_old_commit.go b/pkg/integration/tests/demo/amend_old_commit.go
index 522b11fc0..ac91a34e7 100644
--- a/pkg/integration/tests/demo/amend_old_commit.go
+++ b/pkg/integration/tests/demo/amend_old_commit.go
@@ -11,7 +11,7 @@ var AmendOldCommit = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
config.UserConfig.Gui.ShowFileTree = false
},
SetupRepo: func(shell *Shell) {
diff --git a/pkg/integration/tests/demo/bisect.go b/pkg/integration/tests/demo/bisect.go
index edae1146f..f80ce86a9 100644
--- a/pkg/integration/tests/demo/bisect.go
+++ b/pkg/integration/tests/demo/bisect.go
@@ -11,7 +11,7 @@ var Bisect = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
diff --git a/pkg/integration/tests/demo/cherry_pick.go b/pkg/integration/tests/demo/cherry_pick.go
index d6f16b19b..9f1e10886 100644
--- a/pkg/integration/tests/demo/cherry_pick.go
+++ b/pkg/integration/tests/demo/cherry_pick.go
@@ -11,7 +11,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(50)
diff --git a/pkg/integration/tests/demo/commit_and_push.go b/pkg/integration/tests/demo/commit_and_push.go
index 545d24d1e..360d685ce 100644
--- a/pkg/integration/tests/demo/commit_and_push.go
+++ b/pkg/integration/tests/demo/commit_and_push.go
@@ -11,7 +11,7 @@ var CommitAndPush = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
diff --git a/pkg/integration/tests/demo/commit_graph.go b/pkg/integration/tests/demo/commit_graph.go
index 5ccaecf43..100bfca2b 100644
--- a/pkg/integration/tests/demo/commit_graph.go
+++ b/pkg/integration/tests/demo/commit_graph.go
@@ -11,14 +11,8 @@ var CommitGraph = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
- config.UserConfig.Gui.AuthorColors = map[string]string{
- "Fredrica Greenhill": "#fb5aa3",
- "Oscar Reuenthal": "#86c82f",
- "Paul Oberstein": "#ffd500",
- "Siegfried Kircheis": "#fe7e11",
- "Yang Wen-li": "#8e3ccb",
- }
+ setDefaultDemoConfig(config)
+ setGeneratedAuthorColours(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateRepoHistory()
diff --git a/pkg/integration/tests/demo/custom_command.go b/pkg/integration/tests/demo/custom_command.go
index 46b6b515e..147a63ba4 100644
--- a/pkg/integration/tests/demo/custom_command.go
+++ b/pkg/integration/tests/demo/custom_command.go
@@ -24,9 +24,7 @@ var CustomCommand = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(cfg *config.AppConfig) {
- // No idea why I had to use version 2: it should be using my own computer's
- // font and the one iterm uses is version 3.
- cfg.UserConfig.Gui.NerdFontsVersion = "2"
+ setDefaultDemoConfig(cfg)
cfg.UserConfig.CustomCommands = []config.CustomCommand{
{
diff --git a/pkg/integration/tests/demo/custom_patch.go b/pkg/integration/tests/demo/custom_patch.go
index 70aecd668..3a1440eda 100644
--- a/pkg/integration/tests/demo/custom_patch.go
+++ b/pkg/integration/tests/demo/custom_patch.go
@@ -21,7 +21,7 @@ var CustomPatch = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(cfg *config.AppConfig) {
- cfg.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(cfg)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
diff --git a/pkg/integration/tests/demo/filter.go b/pkg/integration/tests/demo/filter.go
index c6b6acb1a..84fba65f9 100644
--- a/pkg/integration/tests/demo/filter.go
+++ b/pkg/integration/tests/demo/filter.go
@@ -11,7 +11,7 @@ var Filter = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
diff --git a/pkg/integration/tests/demo/interactive_rebase.go b/pkg/integration/tests/demo/interactive_rebase.go
index 56d711c55..3d6709d87 100644
--- a/pkg/integration/tests/demo/interactive_rebase.go
+++ b/pkg/integration/tests/demo/interactive_rebase.go
@@ -11,7 +11,7 @@ var InteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("my-file.txt", "myfile content")
diff --git a/pkg/integration/tests/demo/nuke_working_tree.go b/pkg/integration/tests/demo/nuke_working_tree.go
index c6dde3933..5fb21967d 100644
--- a/pkg/integration/tests/demo/nuke_working_tree.go
+++ b/pkg/integration/tests/demo/nuke_working_tree.go
@@ -11,7 +11,7 @@ var NukeWorkingTree = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
config.UserConfig.Gui.AnimateExplosion = true
},
SetupRepo: func(shell *Shell) {
diff --git a/pkg/integration/tests/demo/rebase_onto.go b/pkg/integration/tests/demo/rebase_onto.go
index 381a2f050..7f5c564a1 100644
--- a/pkg/integration/tests/demo/rebase_onto.go
+++ b/pkg/integration/tests/demo/rebase_onto.go
@@ -11,7 +11,7 @@ var RebaseOnto = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(60)
diff --git a/pkg/integration/tests/demo/shared.go b/pkg/integration/tests/demo/shared.go
new file mode 100644
index 000000000..3b99ddac7
--- /dev/null
+++ b/pkg/integration/tests/demo/shared.go
@@ -0,0 +1,19 @@
+package demo
+
+import "github.com/jesseduffield/lazygit/pkg/config"
+
+// Gives us nicer colours when we generate a git repo history with `shell.CreateRepoHistory()`
+func setGeneratedAuthorColours(config *config.AppConfig) {
+ config.UserConfig.Gui.AuthorColors = map[string]string{
+ "Fredrica Greenhill": "#fb5aa3",
+ "Oscar Reuenthal": "#86c82f",
+ "Paul Oberstein": "#ffd500",
+ "Siegfried Kircheis": "#fe7e11",
+ "Yang Wen-li": "#8e3ccb",
+ }
+}
+
+func setDefaultDemoConfig(config *config.AppConfig) {
+ // demos look much nicers with icons shown
+ config.UserConfig.Gui.NerdFontsVersion = "3"
+}
diff --git a/pkg/integration/tests/demo/stage_lines.go b/pkg/integration/tests/demo/stage_lines.go
index df29ce61d..4e8db4fd4 100644
--- a/pkg/integration/tests/demo/stage_lines.go
+++ b/pkg/integration/tests/demo/stage_lines.go
@@ -39,7 +39,7 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
config.UserConfig.Gui.ShowFileTree = false
config.UserConfig.Gui.ShowCommandLog = false
},
diff --git a/pkg/integration/tests/demo/undo.go b/pkg/integration/tests/demo/undo.go
index 725090ed6..4b47e0726 100644
--- a/pkg/integration/tests/demo/undo.go
+++ b/pkg/integration/tests/demo/undo.go
@@ -11,7 +11,7 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(config *config.AppConfig) {
- config.UserConfig.Gui.NerdFontsVersion = "3"
+ setDefaultDemoConfig(config)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)
diff --git a/pkg/integration/tests/demo/worktree_create_from_branches.go b/pkg/integration/tests/demo/worktree_create_from_branches.go
index d25b531d2..39d2cb73e 100644
--- a/pkg/integration/tests/demo/worktree_create_from_branches.go
+++ b/pkg/integration/tests/demo/worktree_create_from_branches.go
@@ -11,9 +11,7 @@ var WorktreeCreateFromBranches = NewIntegrationTest(NewIntegrationTestArgs{
Skip: false,
IsDemo: true,
SetupConfig: func(cfg *config.AppConfig) {
- // No idea why I had to use version 2: it should be using my own computer's
- // font and the one iterm uses is version 3.
- cfg.UserConfig.Gui.NerdFontsVersion = "2"
+ setDefaultDemoConfig(cfg)
},
SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30)