<commit_before><?php
/**
 * @author <NAME> <<EMAIL>>
 * Date: 7/11/15
 * Time: 1:02 PM
 */

namespace CloudDrive\Commands;

use Symfony\Component\Console\Input\InputArgument;

class UploadCommand extends BaseCommand
{
    protected function configure()
    {
        $this->setName('upload')
            ->setDescription('Upload local file or folder to remote directory')
            ->addArgument('local_path', InputArgument::REQUIRED, 'The location of the local file')
            ->addArgument('remote_path', InputArgument::OPTIONAL, 'The remote folder to upload to')
            ->addOption('overwrite', 'o', null, 'Overwrite remote file if file exists and does not match local copy');
    }

    protected function main()
    {
        $this->init();
        $this->clouddrive->getAccount()->authorize();

        $overwrite = $this->input->getOption('overwrite') ?: false;

        $source = realpath($this->input->getArgument('local_path'));
        $remote = $this->input->getArgument('remote_path') ?: '';

        if (is_dir($source)) {
            $this->clouddrive->uploadDirectory($source, $remote, $overwrite, true);
        } else {
            $response = $this->clouddrive->uploadFile($source, $remote, $overwrite);
            if ($response['success']) {
                $this->output->writeln("Successfully uploaded file $source: " . json_encode($response['data']));
            } else {
                $this->output->writeln("Failed to upload file $source: " . json_encode($response['data']));
            }
        }
    }
}<commit_msg>upload directory progress output now takes a resource object to write to<commit_after><?php
/**
 * @author <NAME> <<EMAIL>>
 * Date: 7/11/15
 * Time: 1:02 PM
 */

namespace CloudDrive\Commands;

use Symfony\Component\Console\Input\InputArgument;

class UploadCommand extends BaseCommand
{
    protected function configure()
    {
        $this->setName('upload')
            ->setDescription('Upload local file or folder to remote directory')
            ->addArgument('local_path', InputArgument::REQUIRED, 'The location of the local file')
            ->addArgument('remote_path', InputArgument::OPTIONAL, 'The remote folder to upload to')
            ->addOption('overwrite', 'o', null, 'Overwrite remote file if file exists and does not match local copy');
    }

    protected function main()
    {
        $this->init();
        $this->clouddrive->getAccount()->authorize();

        $overwrite = $this->input->getOption('overwrite') ?: false;

        $source = realpath($this->input->getArgument('local_path'));
        $remote = $this->input->getArgument('remote_path') ?: '';

        if (is_dir($source)) {
            $this->clouddrive->uploadDirectory($source, $remote, $overwrite, $this->output->getStream());
        } else {
            $response = $this->clouddrive->uploadFile($source, $remote, $overwrite);
            if ($response['success']) {
                $this->output->writeln("Successfully uploaded file $source: " . json_encode($response['data']));
            } else {
                $this->output->writeln("Failed to upload file $source: " . json_encode($response['data']));
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.15483265561463871, 'fraction_numerical': 0.005004691898654989, 'mean_word_length': 2.86231884057971, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 57, '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': '2877429', 'n_tokens_mistral': 898, 'n_tokens_neox': 878, 'n_words': 205}