<commit_before>package main

import (
	"bufio"
	"fmt"
	"github.com/codegangsta/cli"
	"github.com/evoL/gif/store"
	"os"
	"regexp"
)

func ExportCommand(c *cli.Context) {
	s := getStore()
	defer s.Close()

	var targetFile *os.File
	var err error

	output := c.String("output")
	if output == "-" {
		targetFile = os.Stdout
	} else {
		targetFile, err = os.Create(output)
		if err != nil {
			fmt.Println("Could not create file: " + err.Error())
			os.Exit(1)
		}
	}

	// Detect file extension and enable full export
	exportFiles := c.Bool("bundle") || regexp.MustCompile(`(?:\.tar\.gz|\.gifb)\z`).MatchString(output)

	writer := bufio.NewWriter(targetFile)
	defer writer.Flush()

	err = s.Export(writer, store.NullFilter{}, exportFiles)
	if err != nil {
		fmt.Println("Export error: " + err.Error())
		os.Exit(1)
	}
}<commit_msg>Exporting local gifs make no sense when you don't include files.<commit_after>package main

import (
	"bufio"
	"fmt"
	"github.com/codegangsta/cli"
	"github.com/evoL/gif/store"
	"os"
	"regexp"
)

func ExportCommand(c *cli.Context) {
	s := getStore()
	defer s.Close()

	var targetFile *os.File
	var err error

	output := c.String("output")
	if output == "-" {
		targetFile = os.Stdout
	} else {
		targetFile, err = os.Create(output)
		if err != nil {
			fmt.Println("Could not create file: " + err.Error())
			os.Exit(1)
		}
	}

	// Detect file extension and enable full export
	exportFiles := c.Bool("bundle") || regexp.MustCompile(`(?:\.tar\.gz|\.gifb)\z`).MatchString(output)

	// Exporting local gifs makes no sense when you don't include files
	var filter store.Filter
	if exportFiles {
		filter = store.NullFilter{}
	} else {
		filter = store.RemoteFilter{Filter: store.NullFilter{}}
	}

	writer := bufio.NewWriter(targetFile)
	defer writer.Flush()

	err = s.Export(writer, filter, exportFiles)
	if err != nil {
		fmt.Println("Export error: " + err.Error())
		os.Exit(1)
	}
}
{'fraction_non_alphanumeric': 0.16115485564304463, 'fraction_numerical': 0.002099737532808399, 'mean_word_length': 3.6715686274509802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6755772', 'n_tokens_mistral': 743, 'n_tokens_neox': 697, 'n_words': 164}