From bd1b1ed7931cccf9b66612b7f689ae76f5d88b6d Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 22 Apr 2015 13:17:53 -0600 Subject: [PATCH] change the pointer command's switches --- commands/command_pointer.go | 12 ++++++------ commands/pointer_test.go | 14 +++++++------- docs/spec.md | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/commands/command_pointer.go b/commands/command_pointer.go index a60102fe..e47a638a 100644 --- a/commands/command_pointer.go +++ b/commands/command_pointer.go @@ -13,7 +13,7 @@ import ( ) var ( - pointerBuild string + pointerFile string pointerCompare string pointerCmd = &cobra.Command{ Use: "pointer", @@ -32,9 +32,9 @@ func pointerCommand(cmd *cobra.Command, args []string) { comparing = true } - if len(pointerBuild) > 0 { + if len(pointerFile) > 0 { something = true - buildFile, err := os.Open(pointerBuild) + buildFile, err := os.Open(pointerFile) if err != nil { Error(err.Error()) os.Exit(1) @@ -50,7 +50,7 @@ func pointerCommand(cmd *cobra.Command, args []string) { } ptr := pointer.NewPointer(hex.EncodeToString(oidHash.Sum(nil)), size) - fmt.Printf("Git LFS pointer for %s\n\n", pointerBuild) + fmt.Printf("Git LFS pointer for %s\n\n", pointerFile) buf := &bytes.Buffer{} pointer.Encode(io.MultiWriter(os.Stdout, buf), ptr) @@ -114,7 +114,7 @@ func gitHashObject(by []byte) string { func init() { flags := pointerCmd.Flags() - flags.StringVarP(&pointerBuild, "build", "b", "", "Path to a local file to generate the pointer from.") - flags.StringVarP(&pointerCompare, "compare", "c", "", "Path to a local file containing a pointer built by another Git LFS implementation.") + flags.StringVarP(&pointerFile, "file", "f", "", "Path to a local file to generate the pointer from.") + flags.StringVarP(&pointerCompare, "pointer", "p", "", "Path to a local file containing a pointer built by another Git LFS implementation.") RootCmd.AddCommand(pointerCmd) } diff --git a/commands/pointer_test.go b/commands/pointer_test.go index f84a42d6..67cbf6cd 100644 --- a/commands/pointer_test.go +++ b/commands/pointer_test.go @@ -16,7 +16,7 @@ func TestPointerWithBuildAndCompareMismatch(t *testing.T) { "oid sha256:6c17f2007cbe934aee6e309b28b2dba3c119c5dff2ef813ed124699efe319868\n" + "size 123" - cmd := repo.Command("pointer", "--build=some/file", "--compare=some/pointer") + cmd := repo.Command("pointer", "--file=some/file", "--pointer=some/pointer") cmd.Unsuccessful = true cmd.Before(func() { path := filepath.Join(repo.Path, "some") @@ -44,7 +44,7 @@ func TestPointerWithBuildAndCompare(t *testing.T) { "oid sha256:6c17f2007cbe934aee6e309b28b2dba3c119c5dff2ef813ed124699efe319868\n" + "size 7" - cmd := repo.Command("pointer", "--build=some/file", "--compare=some/pointer") + cmd := repo.Command("pointer", "--file=some/file", "--pointer=some/pointer") cmd.Before(func() { path := filepath.Join(repo.Path, "some") assert.Equal(t, nil, os.MkdirAll(path, 0755)) @@ -68,7 +68,7 @@ func TestPointerWithCompare(t *testing.T) { "oid sha256:6c17f2007cbe934aee6e309b28b2dba3c119c5dff2ef813ed124699efe319868\n" + "size 7" - cmd := repo.Command("pointer", "--compare=some/pointer") + cmd := repo.Command("pointer", "--pointer=some/pointer") cmd.Before(func() { path := filepath.Join(repo.Path, "some") filename := filepath.Join(path, "pointer") @@ -83,7 +83,7 @@ func TestPointerWithInvalidCompare(t *testing.T) { repo := NewRepository(t, "empty") defer repo.Test() - cmd := repo.Command("pointer", "--compare=some/pointer") + cmd := repo.Command("pointer", "--pointer=some/pointer") cmd.Output = "open some/pointer: no such file or directory" cmd.Unsuccessful = true } @@ -92,7 +92,7 @@ func TestPointerWithNonPointerCompare(t *testing.T) { repo := NewRepository(t, "empty") defer repo.Test() - cmd := repo.Command("pointer", "--compare=some/pointer") + cmd := repo.Command("pointer", "--pointer=some/pointer") cmd.Before(func() { path := filepath.Join(repo.Path, "some") assert.Equal(t, nil, os.MkdirAll(path, 0755)) @@ -107,7 +107,7 @@ func TestPointerWithBuild(t *testing.T) { repo := NewRepository(t, "empty") defer repo.Test() - cmd := repo.Command("pointer", "--build=some/file") + cmd := repo.Command("pointer", "--file=some/file") cmd.Before(func() { path := filepath.Join(repo.Path, "some") filename := filepath.Join(path, "file") @@ -125,7 +125,7 @@ func TestPointerWithInvalidBuild(t *testing.T) { repo := NewRepository(t, "empty") defer repo.Test() - cmd := repo.Command("pointer", "--build=some/file") + cmd := repo.Command("pointer", "--file=some/file") cmd.Output = "open some/file: no such file or directory" cmd.Unsuccessful = true } diff --git a/docs/spec.md b/docs/spec.md index b29b318d..5db31594 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -58,7 +58,7 @@ don't know or care about. * Run the `pointer` command to generate a pointer file for the given local file: - $ git lfs pointer --build=path/to/file + $ git lfs pointer --file=path/to/file Git LFS pointer for path/to/file: version https://git-lfs.github.com/spec/v1 @@ -70,7 +70,7 @@ a pointer built by another tool. * Write the other implementation's pointer to "other/pointer/file": - $ git lfs pointer --build=path/to/file --compare=other/pointer/file + $ git lfs pointer --file=path/to/file --pointer=other/pointer/file Git LFS pointer for path/to/file: version https://git-lfs.github.com/spec/v1 @@ -90,7 +90,7 @@ a pointer built by another tool. * It can also read STDIN to get the other implementation's pointer: - $ cat other/pointer/file | git lfs pointer --build=path/to/file --stdin + $ cat other/pointer/file | git lfs pointer --file=path/to/file --stdin Git LFS pointer for path/to/file: version https://git-lfs.github.com/spec/v1