 path = require 'path'
-colors = require 'colors'
+
+require 'colors'
 CSON = require 'season'
+optimist = require 'optimist'
+
 config = require './config'
 Command = require './command'
 

        process.stdout.write '\u2717\n'.red
        callback("#{stdout}\n#{stderr}".red)

  publishPackage: (options) ->
    process.stdout.write 'Publishing '
    try
      {name, version} = CSON.readFileSync(CSON.resolve('package')) ? {}

    @fork @atomNpmPath, publishArgs, (code, stderr='', stdout='') ->
      if code is 0
        process.stdout.write '\u2713\n'.green
        callback()
      else
        process.stdout.write '\u2717\n'.red
        callback("#{stdout}\n#{stderr}".red)

  run: (options) ->
    {callback} = options
    options = @parseOptions(options)

    if version = options.argv._[0]
      @versionPackage version, (error) =>
        if error?
          callback(error)
        else
          @publishPackage(options, callback)
    else
      @publishPackage(options, callback)
