Skip to content

Commit

Permalink
394 added cli option --room
Browse files Browse the repository at this point in the history
  • Loading branch information
hollesse committed Mar 24, 2024
1 parent fe9c42f commit ca5392d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Basic Commands(Options):
[--include-uncommitted-changes|-i] Move uncommitted changes to wip branch
[--branch|-b <branch-postfix>] Set wip branch to 'mob/<base-branch>-<branch-postfix>'
[--create] Create the remote branch
[--room <room-name>] 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
Expand All @@ -188,10 +189,12 @@ Basic Commands(Options):
[--branch|-b <branch-postfix>] Set wip branch to 'mob/<base-branch>/<branch-postfix>'
Timer Commands:
timer <minutes> start a <minutes> timer
timer open opens the timer website
start <minutes> start mob session in wip branch and a <minutes> timer
break <minutes> start a <minutes> break timer
timer <minutes> Start a <minutes> timer
[--room <room-name>] Set room name for timer.mob.sh once
timer open Opens the timer website
[--room <room-name>] Set room name for timer.mob.sh once
start <minutes> Start mob session in wip branch and a <minutes> timer
break <minutes> Start a <minutes> break timer
Short Commands (Options and descriptions as above):
s alias for 'start'
Expand Down
6 changes: 6 additions & 0 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Basic Commands with Options:
[--include-uncommitted-changes|-i] Move uncommitted changes to wip branch
[--branch|-b <branch-postfix>] Set wip branch to 'mob/<base-branch>` + configuration.WipBranchQualifierSeparator + `<branch-postfix>'
[--create] Create the remote branch
[--room <room-name>] 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
Expand All @@ -32,10 +33,12 @@ Basic Commands with Options:
[--branch|-b <branch-postfix>] Set wip branch to 'mob/<base-branch>` + configuration.WipBranchQualifierSeparator + `<branch-postfix>'
Timer Commands:
timer <minutes> Start <minutes> minutes timer
timer open Opens the timer website
start <minutes> Start mob session in wip branch and a <minutes> timer
break <minutes> Start <minutes> break timer
timer <minutes> Start a <minutes> timer
[--room <room-name>] Set room name for timer.mob.sh once
timer open Opens the timer website
[--room <room-name>] Set room name for timer.mob.sh once
start <minutes> Start mob session in wip branch and a <minutes> timer
break <minutes> Start a <minutes> break timer
Short Commands (Options and descriptions as above):
s Alias for 'start'
Expand Down

0 comments on commit ca5392d

Please sign in to comment.