From c4673e3258fe96a4bbbf179d90174a97361bbcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20T=C3=B6pfer?= Date: Sun, 24 Mar 2024 16:24:27 +0100 Subject: [PATCH] 394 added cli option --room --- CHANGELOG.md | 3 +++ README.md | 11 ++++++---- configuration/configuration.go | 6 ++++++ configuration/configuration_test.go | 33 +++++++++++++++++++++++++++++ help/help.go | 11 ++++++---- 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab49055..01d29ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 4.5.1 +- Feature: Added cli option `--room` to set the room name of timer.mob.sh once + # 4.5.0 - Removes feature which cancels running timers as this can lead to longer rotations if the codebase is switched. The way it was implemented is also not ideal for virus detection. - Correct typo in the hint for creating a remote branch diff --git a/README.md b/README.md index f750b301..ac750ab1 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ Basic Commands(Options): [--include-uncommitted-changes|-i] Move uncommitted changes to wip branch [--branch|-b ] Set wip branch to 'mob/-' [--create] Create the remote branch + [--room ] Set room name for timer.mob.sh once next [--stay|-s] Stay on wip branch (default) [--return-to-base-branch|-r] Return to base branch @@ -188,10 +189,12 @@ Basic Commands(Options): [--branch|-b ] Set wip branch to 'mob//' Timer Commands: - timer start a timer - timer open opens the timer website - start start mob session in wip branch and a timer - break start a break timer + timer Start a timer + [--room ] Set room name for timer.mob.sh once + timer open Opens the timer website + [--room ] Set room name for timer.mob.sh once + start Start mob session in wip branch and a timer + break Start a break timer Short Commands (Options and descriptions as above): s alias for 'start' diff --git a/configuration/configuration.go b/configuration/configuration.go index e22ed6a2..7f7a48be 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -144,6 +144,12 @@ func ParseArgs(args []string, configuration Configuration) (command string, para newConfiguration.StartCreate = true case "--delete-remote-wip-branch": newConfiguration.ResetDeleteRemoteWipBranch = true + case "--room": + if i+1 != len(args) { + newConfiguration.TimerRoom = args[i+1] + } + i++ // skip consumed parameter + default: if i == 1 { command = arg diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index a353602f..7843ad25 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -72,6 +72,39 @@ func TestParseArgsMessage(t *testing.T) { test.Equals(t, "ci-skip", configuration.WipCommitMessage) } +func TestParseArgsStartRoom(t *testing.T) { + configuration := GetDefaultConfiguration() + test.Equals(t, configuration.WipBranchQualifier, "") + + command, parameters, configuration := ParseArgs([]string{"mob", "start", "--room", "testroom"}, configuration) + + test.Equals(t, "start", command) + test.Equals(t, "", strings.Join(parameters, "")) + test.Equals(t, "testroom", configuration.TimerRoom) +} + +func TestParseArgsTimerRoom(t *testing.T) { + configuration := GetDefaultConfiguration() + test.Equals(t, configuration.WipBranchQualifier, "") + + command, parameters, configuration := ParseArgs([]string{"mob", "timer", "10", "--room", "testroom"}, configuration) + + test.Equals(t, "timer", command) + test.Equals(t, "10", strings.Join(parameters, "")) + test.Equals(t, "testroom", configuration.TimerRoom) +} + +func TestParseArgsTimerOpenRoom(t *testing.T) { + configuration := GetDefaultConfiguration() + test.Equals(t, configuration.WipBranchQualifier, "") + + command, parameters, configuration := ParseArgs([]string{"mob", "timer", "open", "--room", "testroom"}, configuration) + + test.Equals(t, "timer", command) + test.Equals(t, "open", strings.Join(parameters, "")) + test.Equals(t, "testroom", configuration.TimerRoom) +} + func TestMobRemoteNameEnvironmentVariable(t *testing.T) { configuration := setEnvVarAndParse("MOB_REMOTE_NAME", "GITHUB") test.Equals(t, "GITHUB", configuration.RemoteName) diff --git a/help/help.go b/help/help.go index d7378aa1..d14d6903 100644 --- a/help/help.go +++ b/help/help.go @@ -20,6 +20,7 @@ Basic Commands with Options: [--include-uncommitted-changes|-i] Move uncommitted changes to wip branch [--branch|-b ] Set wip branch to 'mob/` + configuration.WipBranchQualifierSeparator + `' [--create] Create the remote branch + [--room ] Set room name for timer.mob.sh once next [--stay|-s] Stay on wip branch (default) [--return-to-base-branch|-r] Return to base branch @@ -32,10 +33,12 @@ Basic Commands with Options: [--branch|-b ] Set wip branch to 'mob/` + configuration.WipBranchQualifierSeparator + `' Timer Commands: - timer Start minutes timer - timer open Opens the timer website - start Start mob session in wip branch and a timer - break Start break timer + timer Start a timer + [--room ] Set room name for timer.mob.sh once + timer open Opens the timer website + [--room ] Set room name for timer.mob.sh once + start Start mob session in wip branch and a timer + break Start a break timer Short Commands (Options and descriptions as above): s Alias for 'start'