<commit_before>package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"io"
	"sort"
	"path/filepath"
	"strings"
	"strconv"
)

var dir_default = "/Users/matt/Documents"
var dir_desc = "directory to store list"

var name_default = "to.txt"
var name_desc = "name of list"

var remove_desc = "number of item to remove"

var to_dir = flag.String("d", dir_default, dir_desc)
var to_name = flag.String("n", name_default, name_desc)
var should_remove = flag.String("r", "", name_desc)
// print path option

func main() {
	flag.Parse()

	to_path := filepath.Join(*to_dir, *to_name)

	var (
		lines []string
		err error
	)
	if lines, err = read_lines(to_path); err != nil {
		fmt.Print(err)
		return
	}

	if len(*should_remove) != 0 {
		// find item with prefix
		var to_remove int
		if to_remove, err = strconv.Atoi(*should_remove); err != nil {
			fmt.Print(err)
			return
		}

		// remove element at to_remove
		copy(lines[to_remove:], lines[(to_remove + 1):len(lines)])
		lines = lines[:len(lines) - 1]
		if err = write_lines(to_path, lines); err != nil {
			fmt.Print(err)
			return
		}
		return
	}

	// just print the lines
	if len(flag.Args()) == 0 {
		for i, line := range lines {
			fmt.Println(i, "-", line)
		}
		return
	}

	// join rest of arguments as item to add
	to := strings.Join(flag.Args(), " ")
	lines = append(lines, to)
	sort.Strings(lines)
	if err = write_lines(to_path, lines); err != nil {
		fmt.Print(err)<commit_msg>print errors as lines<commit_after>package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"io"
	"sort"
	"path/filepath"
	"strings"
	"strconv"
)

var dir_default = "/Users/matt/Documents"
var dir_desc = "directory to store list"

var name_default = "to.txt"
var name_desc = "name of list"

var remove_desc = "number of item to remove"

var to_dir = flag.String("d", dir_default, dir_desc)
var to_name = flag.String("n", name_default, name_desc)
var should_remove = flag.String("r", "", name_desc)
// print path option

func main() {
	flag.Parse()

	to_path := filepath.Join(*to_dir, *to_name)

	var (
		lines []string
		err error
	)
	if lines, err = read_lines(to_path); err != nil {
		fmt.Println(err)
		return
	}

	if len(*should_remove) != 0 {
		// find item with prefix
		var to_remove int
		if to_remove, err = strconv.Atoi(*should_remove); err != nil {
			fmt.Println(err)
			return
		}

		// remove element at to_remove
		copy(lines[to_remove:], lines[(to_remove + 1):len(lines)])
		lines = lines[:len(lines) - 1]
		if err = write_lines(to_path, lines); err != nil {
			fmt.Println(err)
			return
		}
		return
	}

	// just print the lines
	if len(flag.Args()) == 0 {
		for i, line := range lines {
			fmt.Println(i, "-", line)
		}
		return
	}

	// join rest of arguments as item to add
	to := strings.Join(flag.Args(), " ")
	lines = append(lines, to)
	sort.Strings(lines)
	if err = write_lines(to_path, lines); err != nil {
		fmt.Println(err)
{'fraction_non_alphanumeric': 0.1487143849895761, 'fraction_numerical': 0.002779708130646282, 'mean_word_length': 3.5267295597484276, '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': '1097155', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1094, 'n_words': 292}