<commit_before>package plugins

import (
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"strings"

	"github.com/markelog/eclectica/console"
	"github.com/markelog/eclectica/io"
	"github.com/markelog/eclectica/rc"
	"github.com/markelog/eclectica/variables"
)

func composeCommand() string {
	result := "# Eclectic stuff\n"

	for _, language := range Plugins {
		result += "export PATH=" +
			filepath.Join(variables.Home(), language, "current/bin") + ":$PATH\n"
	}

	result += "export PATH=" + variables.DefaultInstall + ":$PATH\n"

	return result
}

func Initiate() (err error) {
	_, err = io.CreateDir(variables.DefaultInstall)
	if err != nil {
		return err
	}

	command := composeCommand()

	return rc.New(command).Add()
}

func StartShell(language string) {
	if strings.Contains(os.Getenv("PATH"), variables.DefaultInstall) == false {
		console.Shell()
		return
	}

	output, _ := exec.Command("hash").CombinedOutput()
	out := string(output)

	ecPath := fmt.Sprintf("/%s/%s", ".eclectica/bin", language)
	binPath := fmt.Sprintf("/%s/%s", "bin", language)

	if strings.Contains(out, binPath) && strings.Contains(out, ecPath) == false {
		console.Shell()
	}
}
<commit_msg>Add additional flag for `hash` command<commit_after>package plugins

import (
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"strings"

	"github.com/markelog/eclectica/console"
	"github.com/markelog/eclectica/io"
	"github.com/markelog/eclectica/rc"
	"github.com/markelog/eclectica/variables"
)

func composeCommand() string {
	result := "# Eclectic stuff\n"

	for _, language := range Plugins {
		result += "export PATH=" +
			filepath.Join(variables.Home(), language, "current/bin") + ":$PATH\n"
	}

	result += "export PATH=" + variables.DefaultInstall + ":$PATH\n"

	return result
}

func Initiate() (err error) {
	_, err = io.CreateDir(variables.DefaultInstall)
	if err != nil {
		return err
	}

	command := composeCommand()

	return rc.New(command).Add()
}

func StartShell(language string) {
	if strings.Contains(os.Getenv("PATH"), variables.DefaultInstall) == false {
		console.Shell()
		return
	}

	output, _ := exec.Command("hash", "-r").CombinedOutput()
	out := string(output)

	ecPath := fmt.Sprintf("/%s/%s", ".eclectica/bin", language)
	binPath := fmt.Sprintf("/%s/%s", "bin", language)

	if strings.Contains(out, binPath) && strings.Contains(out, ecPath) == false {
		console.Shell()
	}
}

{'fraction_non_alphanumeric': 0.1743546339399069, 'fraction_numerical': 0.0, 'mean_word_length': 4.372727272727273, 'pattern_counts': {'":': 4, '<': 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': '3470960', 'n_tokens_mistral': 879, 'n_tokens_neox': 838, 'n_words': 164}