Skip to content

Commit

Permalink
Merge 92b53b5 into 9a72dc1
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Mar 26, 2019
2 parents 9a72dc1 + 92b53b5 commit 92d6e26
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 17 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ $ go get git@github.com/tamada/rrh.git
Usage: rrh [--version] [--help] <command> [<args>]

Available commands are:
add add repositories on the local path to RRH
clone run "git clone" and register it to a group
add add repositories on the local path to RRH.
clone run "git clone" and register it to a group.
config set/unset and list configuration of RRH.
export export RRH database to stdout.
fetch run "git fetch" on the repositories of the given groups
fetch-all run "git fetch" in the all repositories
fetch run "git fetch" on the repositories of the given groups.
fetch-all run "git fetch" in the all repositories.
group add/list/update/remove groups.
list print managed repositories and their groups.
mv move the repositories from groups to another group.
prune prune unnecessary repositories and groups.
rm remove given repository from database.
status show git status of repositories.
Expand Down
2 changes: 1 addition & 1 deletion add/add_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ func (add *AddCommand) parse(args []string, config *common.Config) (*addOptions,
Synopsis returns the simple help message of the command.
*/
func (add *AddCommand) Synopsis() string {
return "add repositories on the local path to RRH"
return "add repositories on the local path to RRH."
}
2 changes: 1 addition & 1 deletion add/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestInvalidOptions(t *testing.T) {

func TestHelpAndSynopsis(t *testing.T) {
var command, _ = AddCommandFactory()
if command.Synopsis() != "add repositories on the local path to RRH" {
if command.Synopsis() != "add repositories on the local path to RRH." {
t.Error("synopsis did not match")
}
if command.Help() != `rrh add [OPTIONS] <REPOSITORY_PATHS...>
Expand Down
2 changes: 1 addition & 1 deletion clone/clone_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ARGUMENTS
Synopsis returns the help message of the command.
*/
func (clone *CloneCommand) Synopsis() string {
return "run \"git clone\" and register it to a group"
return "run \"git clone\" and register it to a group."
}

func (clone *CloneCommand) printIfVerbose(message string) {
Expand Down
2 changes: 1 addition & 1 deletion clone/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ ARGUMENTS
t.Error("help message did not match")
}

if clone.Synopsis() != `run "git clone" and register it to a group` {
if clone.Synopsis() != `run "git clone" and register it to a group.` {
t.Error("synopsis did not match")
}
}
15 changes: 12 additions & 3 deletions common/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,25 @@ func (db *Database) UpdateGroup(groupID string, newGroup Group) bool {
}
for i, group := range db.Groups {
if group.Name == groupID {
db.Groups[i].Name = newGroup.Name
db.Groups[i].Description = newGroup.Description
db.Groups[i].OmitList = newGroup.OmitList
db.updateGroupImpl(i, groupID, newGroup)
}
}
sortIfNeeded(db)

return true
}

func (db *Database) updateGroupImpl(index int, groupID string, newGroup Group) {
db.Groups[index].Name = newGroup.Name
db.Groups[index].Description = newGroup.Description
db.Groups[index].OmitList = newGroup.OmitList
for i, relation := range db.Relations {
if relation.GroupName == groupID {
db.Relations[i].GroupName = newGroup.Name
}
}
}

/*
Relate create the relation between the group and the repository.
The group and the repository are specified by the given parameters.
Expand Down
2 changes: 1 addition & 1 deletion fetch/fetch_all_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ func (fetch *FetchAllCommand) parse(args []string) (*FetchOptions, error) {
Synopsis returns the help message of the command.
*/
func (fetch *FetchAllCommand) Synopsis() string {
return "run \"git fetch\" in the all repositories"
return "run \"git fetch\" in the all repositories."
}
2 changes: 1 addition & 1 deletion fetch/fetch_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ARGUMENTS
}

func (fetch *FetchCommand) Synopsis() string {
return "run \"git fetch\" on the given groups"
return "run \"git fetch\" on the given groups."
}

func (fetch *FetchCommand) Run(args []string) int {
Expand Down
2 changes: 1 addition & 1 deletion move/move_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,5 @@ ARGUMENTS
Synopsis returns the help message of the command.
*/
func (mv *MoveCommand) Synopsis() string {
return "move the repositories from groups to another group"
return "move the repositories from groups to another group."
}
6 changes: 3 additions & 3 deletions move/move_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ func TestMergeType(t *testing.T) {

func TestSynopsis(t *testing.T) {
var mv, _ = MoveCommandFactory()
if mv.Synopsis() != "move the repositories from groups to another group" {
t.Error("Synopsis message is not matched.")
if mv.Synopsis() != "move the repositories from groups to another group." {
t.Error("Synopsis message is not matched")
}
}

Expand All @@ -190,6 +190,6 @@ ARGUMENTS
FROMS... specifies move from, formatted in <GROUP_NAME/REPO_ID>, or <GROUP_NAME>
TO specifies move to, formatted in <GROUP_NAME>`
if mv.Help() != helpMessage {
t.Error("Help message is not matched.")
t.Error("Help message is not matched")
}
}

0 comments on commit 92d6e26

Please sign in to comment.