<commit_before>package main

import (
	"fmt"
	"os"
	"time"

	"github.com/hashicorp/consul-migrate/migrator"
)

func main() {
	os.Exit(realMain(os.Args))
}

func realMain(args []string) int {
	if len(args) != 2 {
		fmt.Println(usage())
		return 1
	}

	// Observe the help flags
	if args[1] == "-h" || args[1] == "--help" {
		fmt.Println(usage())
		return 0
	}

	// Create the migrator
	m, err := migrator.New(args[1])
	if err != nil {
		fmt.Printf("Error creating migrator: %s\n", err)
		return 1
	}

	// Perform the migration
	start := time.Now()
	migrated, err := m.Migrate()
	if err != nil {
		fmt.Printf("Migration failed: %s\n", err)
		return 1
	}

	// Check the result
	if migrated {
		fmt.Printf("Migration completed in %s\n", time.Now().Sub(start))
	} else {
		fmt.Println("Migration has already been completed")
	}
	return 0
}

func usage() string {
	return `Usage: consul-migrate <data-dir>

Consul-migrate is a tool for moving Consul server data from LMDB to BoltDB.
This is a prerequisite for upgrading to Consul >= 0.5.1.

This utility migrates both the Raft log and the KV store, and preserves all
data and indexes. The original MDB data folder will *NOT* be modified during
this process, nor will it be automatically deleted. If anything should fail,
the migration can be re-attempted.
`
}<commit_msg>Update note in CLI usage.<commit_after>package main

import (
	"fmt"
	"os"
	"time"

	"github.com/hashicorp/consul-migrate/migrator"
)

func main() {
	os.Exit(realMain(os.Args))
}

func realMain(args []string) int {
	if len(args) != 2 {
		fmt.Println(usage())
		return 1
	}

	// Observe the help flags
	if args[1] == "-h" || args[1] == "--help" {
		fmt.Println(usage())
		return 0
	}

	// Create the migrator
	m, err := migrator.New(args[1])
	if err != nil {
		fmt.Printf("Error creating migrator: %s\n", err)
		return 1
	}

	// Perform the migration
	start := time.Now()
	migrated, err := m.Migrate()
	if err != nil {
		fmt.Printf("Migration failed: %s\n", err)
		return 1
	}

	// Check the result
	if migrated {
		fmt.Printf("Migration completed in %s\n", time.Now().Sub(start))
	} else {
		fmt.Println("Migration has already been completed")
	}
	return 0
}

func usage() string {
	return `Usage: consul-migrate <data-dir>

Consul-migrate is a tool for moving Consul server data from LMDB to BoltDB.
This is a prerequisite for upgrading to Consul >= 0.5.1.

This utility will migrate all of the data Consul needs to pick up right where
it left off. The original MDB data folder will *NOT* be modified during the
migration process. If any part of the migration fails, it is safe to try again.
This command is also idempotent, and will not re-attempt a migration which has
already been completed.

Upon successful migration, the MDB data directory will be renamed so that it
includes the ".backup" extension. Once you have verified Consul is operational
after the migration, and contains all of the expected data, it is safe to
archive the "mdb.backup" directory and remove it from the Consul server.

Returns 0 on successful migration or no-op, 1 for errors.
`
}
{'fraction_non_alphanumeric': 0.11667208319792005, 'fraction_numerical': 0.008449788755281119, 'mean_word_length': 3.6077844311377247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4830565', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1045, 'n_words': 391}