     process.stdin.on 'end', ->
       tokens = new Textlex().lexSync({filePath, fileContents, scopeName: cli.argv.scope})
       if outputPath
-        fs.writeFileSync(outputPath, JSON.stringify tokens, null, 2)
+        fs.writeFileSync(outputPath, JSON.stringify tokens, null, cli.argv.t)
       else
-        console.log(JSON.stringify tokens, null, 2)
+        console.log(JSON.stringify tokens, null, cli.argv.t)

                .describe('s', 'Scope name of the grammar to use').alias('s', 'scope').string('s')
                .describe('v', 'Output the version').alias('v', 'version').boolean('v')
                .describe('f', 'File path to use for grammar detection when reading from stdin').alias('f', 'file-path').string('f')
  optimist.usage """
    Usage: textlex [options] [file]



    tokens = new Textlex().lexSync({filePath, scopeName: cli.argv.scope})
    if outputPath
      fs.writeFileSync(outputPath, JSON.stringify tokens, null, cli.argv.t)
    else
      console.log(JSON.stringify tokens, null, cli.argv.t)
  else
    filePath = cli.argv.f
    process.stdin.resume()
