Skip to content
Permalink
Browse files

Merge pull request #49 from vmarkovtsev/master

Move the commands to importable "impl" package
  • Loading branch information...
jfontan committed Sep 26, 2019
2 parents a73bed3 + c7783a5 commit 4ba248c1cf1003995d356f11935287b3e99decca
@@ -1,4 +1,4 @@
package main
package impl

import (
"fmt"
@@ -1,4 +1,4 @@
package main
package impl

import (
"bytes"
@@ -13,7 +13,7 @@ var _ = Suite(&ListSuite{})

func (s *ListSuite) TestBasic(c *C) {
cmd := &CmdList{}
cmd.Args.File = "../../fixtures/perms.siva"
cmd.Args.File = "../../../fixtures/perms.siva"

output := captureOutput(func() {
err := cmd.Execute(nil)
@@ -1,4 +1,4 @@
package main
package impl

import (
"fmt"
@@ -1,4 +1,4 @@
package main
package impl

import (
"io/ioutil"
@@ -1,4 +1,4 @@
package main
package impl

import (
"fmt"
@@ -9,7 +9,7 @@ import (
"github.com/jessevdk/go-flags"
)

func main() {
func Main() {
parser := flags.NewNamedParser("siva", flags.Default)
parser.AddCommand("pack", "Create a new archive containing the specified items.", "", &CmdPack{})
parser.AddCommand("unpack", "Extract to disk from the archive.", "", &CmdUnpack{})
@@ -1,4 +1,4 @@
package main
package impl

import (
"fmt"
@@ -1,4 +1,4 @@
package main
package impl

import (
"io/ioutil"
@@ -29,7 +29,7 @@ func (s *UnpackSuite) TearDownTest(c *C) {
func (s *UnpackSuite) TestBasic(c *C) {
cmd := &CmdUnpack{}
cmd.Output.Path = filepath.Join(s.folder, "files")
cmd.Args.File = filepath.Join("..", "..", "fixtures", "perms.siva")
cmd.Args.File = filepath.Join("..", "..", "..", "fixtures", "perms.siva")
cmd.Overwrite = true

err := cmd.Execute(nil)
@@ -57,7 +57,7 @@ func (s *UnpackSuite) TestBasic(c *C) {
func (s *UnpackSuite) TestIgnorePerms(c *C) {
cmd := &CmdUnpack{}
cmd.Output.Path = filepath.Join(s.folder, "files")
cmd.Args.File = filepath.Join("..", "..", "fixtures", "perms.siva")
cmd.Args.File = filepath.Join("..", "..", "..", "fixtures", "perms.siva")
cmd.IgnorePerms = true

err := cmd.Execute(nil)
@@ -75,7 +75,7 @@ func (s *UnpackSuite) TestIgnorePerms(c *C) {
func (s *UnpackSuite) TestMatch(c *C) {
cmd := &CmdUnpack{}
cmd.Output.Path = filepath.Join(s.folder, "files")
cmd.Args.File = filepath.Join("..", "..", "fixtures", "basic.siva")
cmd.Args.File = filepath.Join("..", "..", "..", "fixtures", "basic.siva")
cmd.Match = "gopher(.*)"

err := cmd.Execute(nil)
@@ -90,7 +90,7 @@ func (s *UnpackSuite) TestMatch(c *C) {
func (s *UnpackSuite) TestOverwrite(c *C) {
cmd := &CmdUnpack{}
cmd.Output.Path = filepath.Join(s.folder, "files")
cmd.Args.File = filepath.Join("..", "..", "fixtures", "duplicate.siva")
cmd.Args.File = filepath.Join("..", "..", "..", "fixtures", "duplicate.siva")
cmd.Overwrite = true

err := cmd.Execute(nil)
@@ -104,7 +104,7 @@ func (s *UnpackSuite) TestOverwrite(c *C) {
func (s *UnpackSuite) TestZipSlip(c *C) {
cmd := &CmdUnpack{}
cmd.Output.Path = filepath.Join(s.folder, "files/inside")
cmd.Args.File = filepath.Join("..", "..", "fixtures", "zipslip.siva")
cmd.Args.File = filepath.Join("..", "..", "..", "fixtures", "zipslip.siva")

err := cmd.Execute(nil)
c.Assert(err, NotNil)
@@ -1,5 +1,5 @@
// +build !windows

package main
package impl

const defaultPerms = 0755
@@ -1,5 +1,5 @@
// +build windows

package main
package impl

const defaultPerms = 0666
@@ -1,4 +1,4 @@
package main
package impl

import (
"fmt"
@@ -0,0 +1,7 @@
package main

import "gopkg.in/src-d/go-siva.v1/cmd/siva/impl"

func main() {
impl.Main()
}

0 comments on commit 4ba248c

Please sign in to comment.
You can’t perform that action at this time.