<commit_before>package provisioning

import "github.com/wingedpig/loom"

// Provisioning contains the provisioning method only.
type Provisioning interface {
	Execute(c Cmd) (string, error)
}

// Conf contains ssh and other configuration data needed for all the public functions in provisioning stage.
type Conf struct  {
	loom.Config
}

// MakeConfig generate the configuration for ssh login.
func MakeConfig(user, host string, output, abort bool) (*Conf, error) {
	return &Conf{loom.Config{User: user, Host: host,
		DisplayOutput: output, AbortOnError: abort}}, nil
}

// Cmd contains command line configurations.
type Cmd struct {
	// AptCache is using the apt-get update before execute the command line.
	AptCache bool

	// CmdLine contains the command line.
	CmdLine string

	// UseSudo is the sudo privilege.
	UseSudo bool

}

// Execute takes a command and runs it on the remote host over ssh.
func (c *Conf) Execute(d Cmd) (string, error) {
	if d.AptCache {
		return c.Sudo("apt-get update")
	}
	if d.UseSudo {
		return c.Sudo(d.CmdLine)
	}
	return c.Run(d.CmdLine)
}

// GetFile copies the file from the remote host to the local FastForward server, using scp. Wildcards are not currently supported. 
func (c *Conf) GetFile(remotefile string, localfile string) error {
	return c.Get(remotefile, localfile)
}<commit_msg>Update interface and fix Exec bugs<commit_after>package provisioning

import "github.com/wingedpig/loom"

// Provisioning contains the provisioning method only.
type Provisioning interface {
	Execute(c Cmd) (string, error)
	GetFile(remotefile string, localfile string) error
}

// Conf contains ssh and other configuration data needed for all the public functions in provisioning stage.
type Conf struct  {
	loom.Config
}

// MakeConfig generate the configuration for ssh login.
func MakeConfig(user, host string, output, abort bool) (*Conf, error) {
	return &Conf{loom.Config{User: user, Host: host,
		DisplayOutput: output, AbortOnError: abort}}, nil
}

// Cmd contains command line configurations.
type Cmd struct {
	// AptCache is using the apt-get update before execute the command line.
	AptCache bool

	// CmdLine contains the command line.
	CmdLine string

	// UseSudo is the sudo privilege.
	UseSudo bool

}

// Execute takes a command and runs it on the remote host over ssh.
func (c *Conf) Execute(d Cmd) (result string, err error) {
	if d.AptCache {
		c.Sudo("apt-get update")
	}
	if d.UseSudo {
		result, err = c.Sudo(d.CmdLine)
	} else {
		result, err = c.Run(d.CmdLine)
	}
	return
}

// GetFile copies the file from the remote host to the local FastForward server, using scp. Wildcards are not currently supported. 
func (c *Conf) GetFile(remotefile string, localfile string) error {
	return c.Get(remotefile, localfile)
}
{'fraction_non_alphanumeric': 0.08791606367583213, 'fraction_numerical': 0.0, 'mean_word_length': 4.082720588235294, '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': '4497060', 'n_tokens_mistral': 887, 'n_tokens_neox': 865, 'n_words': 335}