<commit_before>var async = require('async');
var fs = require('fs');

var configPath = __dirname + '/config.json';
var config = require(configPath);

var path = __dirname + '/test_downloads';
var Spotify = require(__dirname + '/lib/spotify');

var argv = require('minimist')(process.argv.slice(2));

var switchCb = function (err) {
    if(err){
        console.log(err);
    }

    process.exit();
}

Spotify(config.username, config.password, function (err, spotify){

    switch (argv._[0]){
        case 'help':
            console.log('helping');

        case 'config':
            
            var user = argv['u'] || argv['username'] || argv['user']
            var pass = argv['p'] || argv['password'] || argv['pass']
            
            var newConf = config;

            if(user){
                newConf.username = user;
            }

            if(pass){
                newConf.password = <PASSWORD>;
            }
            fs.writeFileSync(configPath, JSON.stringify(newConf));
            process.exit();
            break;
        case 'playlist':
            if(!argv._[1]){
                console.log('You must provide a playlist url');
                process.exit();
            }
            spotify.downloadPlaylistByUrl(argv._[1], path, switchCb);
            break;
        case 'track':
            if(!argv._[1]){
                console.log('You must provide a track url');
                process.exit();
            }
            spotify.getTrackByUrl(argv._[1], path, switchCb);
            break;
        case 'search':
            break;
        default:
            console.log('Use `$ spotijay help` to list different commands');
            process.exit();

    }

});<commit_msg>Allowed to change download path<commit_after>var async = require('async');
var fs = require('fs');

var configPath = __dirname + '/config.json';
var config = require(configPath);

var path = config.dirname;
var Spotify = require(__dirname + '/lib/spotify');

var argv = require('minimist')(process.argv.slice(2));

var switchCb = function (err) {
    if(err){
        console.log(err);
    }

    process.exit();
}

Spotify(config.username, config.password, function (err, spotify){

    switch (argv._[0]){
        case 'help':
            console.log('helping');

        case 'config':
            
            var user = argv['u'] || argv['username'] || argv['user']
            var pass = argv['p'] || argv['password'] || argv['pass']
            
            var dir = argv['d'] || argv['dir'] || argv['dirname']

            var newConf = config;

            if(user){
                newConf.username = user;
            }

            if(pass){
                newConf.password = <PASSWORD>;
            }

            if(dir){
                if (dir == '.'){dir = process.cwd()} else if (dir.substring(0, 0) !== '/'){dir = process.cwd() + '/' + dir}
                console.log('Download path set to: ' + dir);
                newConf.dirname = dir;
            }

            fs.writeFileSync(configPath, JSON.stringify(newConf));
            process.exit();
            break;
        case 'playlist':
            if(!argv._[1]){
                console.log('You must provide a playlist url');
                process.exit();
            }
            spotify.downloadPlaylistByUrl(argv._[1], path, switchCb);
            break;
        case 'track':
            if(!argv._[1]){
                console.log('You must provide a track url');
                process.exit();
            }
            spotify.getTrackByUrl(argv._[1], path, switchCb);
            break;
        case 'search':
            break;
        default:
            console.log('Use `$ spotijay help` to list different commands');
            process.exit();

    }

});
{'fraction_non_alphanumeric': 0.147315524993388, 'fraction_numerical': 0.0037027241470510446, 'mean_word_length': 1.6746817538896748, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6547724', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1043, 'n_words': 239}