diff --git a/cmd/multifile/manifest.go b/cmd/multifile/manifest.go index 86430ef..9781a5d 100644 --- a/cmd/multifile/manifest.go +++ b/cmd/multifile/manifest.go @@ -4,6 +4,8 @@ import ( "bufio" "errors" "fmt" + "github.com/replicate/pget/pkg/config" + "github.com/spf13/viper" "io" "io/fs" "os" @@ -86,18 +88,22 @@ func parseManifest(file io.Reader) (pget.Manifest, error) { return nil, err } - err = checkSeenDests(seenDests, dest, urlString) - if err != nil { - return nil, err - } - - seenDests[dest] = urlString - - err = cli.EnsureDestinationNotExist(dest) - 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 + } } - schemeHost, err := client.GetSchemeHostKey(urlString) if err != nil { return nil, fmt.Errorf("error parsing url %s: %w", urlString, err) diff --git a/cmd/root/root.go b/cmd/root/root.go index 593f0f9..f37a614 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -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