<commit_before>#!/usr/bin/env node

import { Input } from './lib/input';
import { jsonPrettify } from './lib/json_prettify';
import { Output } from './lib/output';
import * as process from 'process';
import * as yargs from 'yargs';



async function main(): Promise<void> {

    const argv = yargs.usage('Usage: $0 file.json [options] or cat file.json | $0 [options]' )
        .command( 'out', 'out file path' )
        .alias( 'o', 'out' )
        .command( 'spaces', 'amount of spaces for indentation' )
        .alias( 's', 'spaces' )
        .argv;

    const input = new Input( argv._.length > 0 ? argv._[ 0 ] : null );
    const json = await input.read();

    const spaces = parseInt( argv.spaces as string, 10 );

    const output = new Output( jsonPrettify( json, spaces ), argv.out as string );
    await output.write();

}

main()
    .then( () => process.exit( 0 ) )
    .catch( function( error ) {

        console.error( error );
        process.exit( 1 );

    });<commit_msg>fixed: default --spaces to 4<commit_after>#!/usr/bin/env node

import { Input } from './lib/input';
import { jsonPrettify } from './lib/json_prettify';
import { Output } from './lib/output';
import * as process from 'process';
import * as yargs from 'yargs';



async function main(): Promise<void> {

    const argv = yargs.usage('Usage: $0 file.json [options] or cat file.json | $0 [options]' )
        .command( 'out', 'out file path' )
        .alias( 'o', 'out' )
        .command( 'spaces', 'amount of spaces for indentation', {
            number: {
                alias: 's',
                default: 4
            }
        })
        .argv;

    const input = new Input( argv._.length > 0 ? argv._[ 0 ] : null );
    const json = await input.read();

    let spaces = parseInt( argv.spaces as string, 10 );
    if ( isNaN( spaces ) ) {
        spaces = 4;
    }

    const output = new Output( jsonPrettify( json, spaces ), argv.out as string );
    await output.write();

}

main()
    .then( () => process.exit( 0 ) )
    .catch( function( error ) {

        console.error( error );
        process.exit( 1 );

    });
{'fraction_non_alphanumeric': 0.15826660386245878, 'fraction_numerical': 0.008949599623174752, 'mean_word_length': 2.313572542901716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3556408', 'n_tokens_mistral': 697, 'n_tokens_neox': 657, 'n_words': 213}