<commit_before>delegate = require 'atom-delegate'
app = require 'app'
fs = require 'fs'
path = require 'path'
optimist = require 'optimist'
nslog = require 'nslog'
AtomApplication = require './atom-application'
_ = require 'underscore'

console.log = (args...) ->
  nslog(args.map((arg) -> JSON.stringify(arg)).join(" "))

require 'coffee-script'

delegate.browserMainParts.preMainMessageLoopRun = ->
  args = parseCommandLine()

  addPathToOpen = (event, filePath) ->
    event.preventDefault()
    args.pathsToOpen.push(filePath)

  app.on 'open-file', addPathToOpen
  app.on 'finish-launching', ->
    app.removeListener 'open-file', addPathToOpen

    args.pathsToOpen = args.pathsToOpen.map (pathToOpen) ->
      path.resolve(args.executedFrom ? process.cwd(), pathToOpen)
    args.pathToOpen = _.uniq(args.pathsToOpen)

    AtomApplication.open(args)

getHomeDir = ->
  process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']

parseCommandLine = ->
  version = fs.readFileSync(path.join(__dirname, '..', '..', 'version'), 'utf8')

  options = optimist(process.argv[1..])
  options.usage """
    Atom #{version}

    Usage: atom [options] [file ..]
  """
  options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
  options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.')
  options.alias('t', 'test').boolean('t').describe('t', 'Run the Atom specs and exit with error code on failures.')
  options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.')
  args = options.argv<commit_msg>Since files passed in command line won't trigger 'open-file' any more, there is no need to clean duplicate paths.<commit_after>delegate = require 'atom-delegate'
app = require 'app'
fs = require 'fs'
path = require 'path'
optimist = require 'optimist'
nslog = require 'nslog'
AtomApplication = require './atom-application'
_ = require 'underscore'

console.log = (args...) ->
  nslog(args.map((arg) -> JSON.stringify(arg)).join(" "))

require 'coffee-script'

delegate.browserMainParts.preMainMessageLoopRun = ->
  args = parseCommandLine()

  addPathToOpen = (event, filePath) ->
    event.preventDefault()
    args.pathsToOpen.push(filePath)

  app.on 'open-file', addPathToOpen
  app.on 'finish-launching', ->
    app.removeListener 'open-file', addPathToOpen

    args.pathsToOpen = args.pathsToOpen.map (pathToOpen) ->
      path.resolve(args.executedFrom ? process.cwd(), pathToOpen)

    AtomApplication.open(args)

getHomeDir = ->
  process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']

parseCommandLine = ->
  version = fs.readFileSync(path.join(__dirname, '..', '..', 'version'), 'utf8')

  options = optimist(process.argv[1..])
  options.usage """
    Atom #{version}

    Usage: atom [options] [file ..]
  """
  options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
  options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.')
  options.alias('t', 'test').boolean('t').describe('t', 'Run the Atom specs and exit with error code on failures.')
  options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.')
  args = options.argv
{'fraction_non_alphanumeric': 0.17070924163340498, 'fraction_numerical': 0.002456248081056187, 'mean_word_length': 4.349753694581281, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '570456', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1038, 'n_words': 243}