From f6e88d7404685ec85e62df4c6732875fcd5c45cf Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Mon, 9 May 2016 10:21:17 -0400 Subject: [PATCH 1/2] Linted object diff help text License: MIT Signed-off-by: Richard Littauer --- core/commands/object/diff.go | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/core/commands/object/diff.go b/core/commands/object/diff.go index 06fd1fab3d9..902bf32d77f 100644 --- a/core/commands/object/diff.go +++ b/core/commands/object/diff.go @@ -17,37 +17,37 @@ type Changes struct { var ObjectDiffCmd = &cmds.Command{ Helptext: cmds.HelpText{ - Tagline: "takes a diff of the two given objects", + Tagline: "Takes a diff of the two given objects.", ShortDescription: ` -ipfs object diff is a command used to show the differences between +'ipfs object diff' is a command used to show the differences between two ipfs objects.`, LongDescription: ` -ipfs object diff is a command used to show the differences between +'ipfs object diff' is a command used to show the differences between two ipfs objects. Example: - $ ls foo + > ls foo bar baz/ giraffe - $ ipfs add -r foo + > ipfs add -r foo ... - added QmegHcnrPgMwC7tBiMxChD54fgQMBUecNw9nE9UUU4x1bz foo - $ OBJ_A=QmegHcnrPgMwC7tBiMxChD54fgQMBUecNw9nE9UUU4x1bz - $ echo "different content" > foo/bar - $ ipfs add -r foo + Added QmegHcnrPgMwC7tBiMxChD54fgQMBUecNw9nE9UUU4x1bz foo + > OBJ_A=QmegHcnrPgMwC7tBiMxChD54fgQMBUecNw9nE9UUU4x1bz + > echo "different content" > foo/bar + > ipfs add -r foo ... - added QmcmRptkSPWhptCttgHg27QNDmnV33wAJyUkCnAvqD3eCD foo - $ OBJ_B=QmcmRptkSPWhptCttgHg27QNDmnV33wAJyUkCnAvqD3eCD - $ ipfs object diff -v $OBJ_A $OBJ_B - changed "bar" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb + Added QmcmRptkSPWhptCttgHg27QNDmnV33wAJyUkCnAvqD3eCD foo + > OBJ_B=QmcmRptkSPWhptCttgHg27QNDmnV33wAJyUkCnAvqD3eCD + > ipfs object diff -v $OBJ_A $OBJ_B + Changed "bar" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb. `, }, Arguments: []cmds.Argument{ - cmds.StringArg("obj_a", true, false, "object to diff against"), - cmds.StringArg("obj_b", true, false, "object to diff"), + cmds.StringArg("obj_a", true, false, "Object to diff against."), + cmds.StringArg("obj_b", true, false, "Object to diff."), }, Options: []cmds.Option{ - cmds.BoolOption("verbose", "v", "Produce verbose output"), + cmds.BoolOption("verbose", "v", "Produce verbose output."), }, Run: func(req cmds.Request, res cmds.Response) { node, err := req.InvocContext().GetNode() @@ -103,11 +103,11 @@ Example: if verbose { switch change.Type { case dagutils.Add: - fmt.Fprintf(buf, "added new link %q pointing to %s\n", change.Path, change.After) + fmt.Fprintf(buf, "Added new link %q pointing to %s.\n", change.Path, change.After) case dagutils.Mod: - fmt.Fprintf(buf, "changed %q from %s to %s\n", change.Path, change.Before, change.After) + fmt.Fprintf(buf, "Changed %q from %s to %s.\n", change.Path, change.Before, change.After) case dagutils.Remove: - fmt.Fprintf(buf, "removed link %q (was %s)\n", change.Path, change.Before) + fmt.Fprintf(buf, "Removed link %q (was %s).\n", change.Path, change.Before) } } else { switch change.Type { From f419f3aba6d611cb8acbc944ad8fa75dc42be47f Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 10 May 2016 10:39:53 -0400 Subject: [PATCH 2/2] Fixed tests License: MIT Signed-off-by: Richard Littauer --- test/sharness/t0052-object-diff.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sharness/t0052-object-diff.sh b/test/sharness/t0052-object-diff.sh index 3769b803eac..9fe357ae4aa 100755 --- a/test/sharness/t0052-object-diff.sh +++ b/test/sharness/t0052-object-diff.sh @@ -46,7 +46,7 @@ test_expect_success "verbose diff added link works" ' ' test_expect_success "verbose diff added link looks right" ' - echo added new link \"cat\" pointing to QmUSvcqzhdfYM1KLDbM76eLPdS9ANFtkJvFuPYeZt73d7A > diff_exp && + echo Added new link \"cat\" pointing to QmUSvcqzhdfYM1KLDbM76eLPdS9ANFtkJvFuPYeZt73d7A. > diff_exp && test_cmp diff_exp diff_out ' @@ -55,7 +55,7 @@ test_expect_success "diff removed link works" ' ' test_expect_success "diff removed link looks right" ' - echo removed link \"cat\" \(was QmUSvcqzhdfYM1KLDbM76eLPdS9ANFtkJvFuPYeZt73d7A\) > diff_exp && + echo Removed link \"cat\" \(was QmUSvcqzhdfYM1KLDbM76eLPdS9ANFtkJvFuPYeZt73d7A\). > diff_exp && test_cmp diff_exp diff_out ' @@ -64,7 +64,7 @@ test_expect_success "diff nested add works" ' ' test_expect_success "diff looks right" ' - echo added new link \"baz/dog\" pointing to QmdNJQUTZuDpsUcec7YDuCfRfvw1w4J13DCm7YcU4VMZdS > diff_exp && + echo Added new link \"baz/dog\" pointing to QmdNJQUTZuDpsUcec7YDuCfRfvw1w4J13DCm7YcU4VMZdS. > diff_exp && test_cmp diff_exp diff_out ' @@ -73,7 +73,7 @@ test_expect_success "diff changed link works" ' ' test_expect_success "diff looks right" ' - echo changed \"bar\" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb > diff_exp && + echo Changed \"bar\" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb. > diff_exp && test_cmp diff_exp diff_out '