Skip to content

Commit

Permalink
Do not check destinations or files for output consumer null
Browse files Browse the repository at this point in the history
  • Loading branch information
tempusfrangit committed Dec 15, 2023
1 parent 5eceeda commit 3c0908a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
29 changes: 18 additions & 11 deletions cmd/multifile/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import (
"os"
"strings"

"github.com/spf13/viper"

pget "github.com/replicate/pget/pkg"
"github.com/replicate/pget/pkg/cli"
"github.com/replicate/pget/pkg/client"
"github.com/replicate/pget/pkg/config"
)

// A manifest is a file consisting of pairs of URLs and paths:
Expand Down Expand Up @@ -86,18 +89,22 @@ func parseManifest(file io.Reader) (pget.Manifest, error) {
return nil, err
}

err = checkSeenDests(seenDests, dest, urlString)
if err != nil {
return nil, err
// THIS IS A BODGE - FIX ME MOVE THESE THINGS TO PGET
// and make the consumer responsible for knowing if this
// is allowed/not allowed/etc
consumer := viper.GetString(config.OptOutputConsumer)
if consumer != config.ConsumerNull {
err = checkSeenDests(seenDests, dest, urlString)
if err != nil {
return nil, err
}
seenDests[dest] = urlString

err = cli.EnsureDestinationNotExist(dest)
if err != nil {
return nil, err
}
}

seenDests[dest] = urlString

err = cli.EnsureDestinationNotExist(dest)
if err != nil {
return nil, err
}

schemeHost, err := client.GetSchemeHostKey(urlString)
if err != nil {
return nil, fmt.Errorf("error parsing url %s: %w", urlString, err)
Expand Down
8 changes: 6 additions & 2 deletions cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ func runRootCMD(cmd *cobra.Command, args []string) error {
Str("minimum_chunk_size", viper.GetString(config.OptMinimumChunkSize)).
Msg("Initiating")

if err := cli.EnsureDestinationNotExist(dest); err != nil {
return err
// OMG BODGE FIX THIS
consumer := viper.GetString(config.OptOutputConsumer)
if consumer != config.ConsumerNull {
if err := cli.EnsureDestinationNotExist(dest); err != nil {
return err
}
}
if err := rootExecute(cmd.Context(), urlString, dest); err != nil {
return err
Expand Down

0 comments on commit 3c0908a

Please sign in to comment.