<commit_before>package main

import (
	"flag"
	"fmt"
	"os"
	"text/tabwriter"

	"github.com/BurntSushi/csql"

	"github.com/BurntSushi/goim/imdb"
)

var cmdSize = &command{
	name:      "size",
	shortHelp: "lists size of tables and total size of database",
	help:      "",
	flags:     flag.NewFlagSet("size", flag.ExitOnError),
	run:       size,
}

func size(c *command) bool {
	db := openDb(c.dbinfo())
	defer closeDb(db)

	tables, err := db.Tables()
	if err != nil {
		pef("%s", err)
		return false
	}
	tw := tabwriter.NewWriter(os.Stdout, 0, 2, 4, ' ', 0)
	for _, table := range tables {
		fmt.Fprintf(tw, "%s\t%s\n", table, tableSize(db, table))
	}

	_, dsn := c.dbinfo()
	total := databaseSize(db, dsn)
	fmt.Fprintf(tw, "total\t%s\n", total)
	tw.Flush()
	return true<commit_msg>Make name of 'size' command function consistent.<commit_after>package main

import (
	"flag"
	"fmt"
	"os"
	"text/tabwriter"

	"github.com/BurntSushi/csql"

	"github.com/BurntSushi/goim/imdb"
)

var cmdSize = &command{
	name:      "size",
	shortHelp: "lists size of tables and total size of database",
	help:      "",
	flags:     flag.NewFlagSet("size", flag.ExitOnError),
	run:       cmd_size,
}

func cmd_size(c *command) bool {
	db := openDb(c.dbinfo())
	defer closeDb(db)

	tables, err := db.Tables()
	if err != nil {
		pef("%s", err)
		return false
	}
	tw := tabwriter.NewWriter(os.Stdout, 0, 2, 4, ' ', 0)
	for _, table := range tables {
		fmt.Fprintf(tw, "%s\t%s\n", table, tableSize(db, table))
	}

	_, dsn := c.dbinfo()
	total := databaseSize(db, dsn)
	fmt.Fprintf(tw, "total\t%s\n", total)
	tw.Flush()
	return true
{'fraction_non_alphanumeric': 0.17404865876481598, 'fraction_numerical': 0.004990642545227698, 'mean_word_length': 3.531073446327684, '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': '7336100', 'n_tokens_mistral': 685, 'n_tokens_neox': 656, 'n_words': 153}