<commit_before>package command

import (
	"os"
	"os/user"

	"path/filepath"

	"github.com/urfave/cli"
)

const SSH_ALIASES_DIR = ".ssh-aliases"

type CLI struct {
	version string
}

func NewCLI(version string) *CLI {
	return &CLI{
		version: version,
	}
}

func (c *CLI) ConfigureCLI() error {
	homeDir, err := c.homeDir()
	if err != nil {
		return err
	}
	var scanDir string
	var save bool
	var file string

	app := cli.NewApp()
	app.Version = c.version
	app.Name = "ssh-aliases"
	app.Usage = "Template driven SSH config generation"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:        "scan",
			Usage:       "Path to scan for input HCL config files",
			Value:       filepath.Join(homeDir, SSH_ALIASES_DIR),
			Destination: &scanDir,
		},
	}
	app.Commands = []cli.Command{{
		Name:    "list",
		Aliases: []string{"l"},
		Usage:   "Prints to stdout the list of aliases and target hosts",
		Action: func(ctx *cli.Context) error {
			err := NewListCommand(os.Stdout).Execute(scanDir)
			if err != nil {
				return cli.NewExitError(err.Error(), 1)
			}
			return nil
		},
	}, {
		Name:    "compile",
		Aliases: []string{"c"},
		Usage:   "Prints compiled SSH config file to stdout (default) or writes it to a file",
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:        "save",
				Usage:       "Write compilation output to file instead of printing to stdout",
				Destination: &save,
			},
			cli.StringFlag{
				Name:        "file",
				Usage:       "Destination file path",
				Destination: &file,
				Value:       filepath.Join(homeDir, ".ssh", "config"),
			},
		},
		Action: func(ctx *cli.Context) error {
			var err error
			if save {
				err = NewCompileSaveCommand(file).Execute(scanDir)
			} else {
				err = NewCompileCommand(os.Stdout).Execute(scanDir)
			}
			if err != nil {
				return cli.NewExitError(err.Error(), 1)
			}
			return nil
		},
	}}
	app.Run(os.Args)
	return nil
}

func (c *CLI) homeDir() (string, error) {
	usr, err := user.Current()
	if err != nil {
		return "", err
	}
	return usr.HomeDir, nil
}
<commit_msg>Change default scan dir to ~/.ssh_aliases<commit_after>package command

import (
	"os"
	"os/user"

	"path/filepath"

	"github.com/urfave/cli"
)

const sshAliasesDir = ".ssh_aliases"

type CLI struct {
	version string
}

func NewCLI(version string) *CLI {
	return &CLI{
		version: version,
	}
}

func (c *CLI) ConfigureCLI() error {
	homeDir, err := c.homeDir()
	if err != nil {
		return err
	}
	var scanDir string
	var save bool
	var file string

	app := cli.NewApp()
	app.Version = c.version
	app.Name = "ssh-aliases"
	app.Usage = "Template driven SSH config generation"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:        "scan",
			Usage:       "Path to scan for input HCL config files",
			Value:       filepath.Join(homeDir, sshAliasesDir),
			Destination: &scanDir,
		},
	}
	app.Commands = []cli.Command{{
		Name:    "list",
		Aliases: []string{"l"},
		Usage:   "Prints to stdout the list of aliases and target hosts",
		Action: func(ctx *cli.Context) error {
			err := NewListCommand(os.Stdout).Execute(scanDir)
			if err != nil {
				return cli.NewExitError(err.Error(), 1)
			}
			return nil
		},
	}, {
		Name:    "compile",
		Aliases: []string{"c"},
		Usage:   "Prints compiled SSH config file to stdout (default) or writes it to a file",
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:        "save",
				Usage:       "Write compilation output to file instead of printing to stdout",
				Destination: &save,
			},
			cli.StringFlag{
				Name:        "file",
				Usage:       "Destination file path",
				Destination: &file,
				Value:       filepath.Join(homeDir, ".ssh", "config"),
			},
		},
		Action: func(ctx *cli.Context) error {
			var err error
			if save {
				err = NewCompileSaveCommand(file).Execute(scanDir)
			} else {
				err = NewCompileCommand(os.Stdout).Execute(scanDir)
			}
			if err != nil {
				return cli.NewExitError(err.Error(), 1)
			}
			return nil
		},
	}}
	app.Run(os.Args)
	return nil
}

func (c *CLI) homeDir() (string, error) {
	usr, err := user.Current()
	if err != nil {
		return "", err
	}
	return usr.HomeDir, nil
}

{'fraction_non_alphanumeric': 0.1385512882839086, 'fraction_numerical': 0.0009722897423432182, 'mean_word_length': 2.9004739336492893, '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': '2917644', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1482, 'n_words': 403}