   # tag - The string Git tag of the new version.
   # callback - The callback function to invoke with an error as the first
   #            argument.
-  createPackageVersion: (packageName, tag, callback) ->
+  createPackageVersion: (packageName, tag, options, callback) ->
     Login.getTokenOrLogin (error, token) ->
       if error?
         callback(error)


      Usage: apm publish [<newversion> | major | minor | patch | build]
             apm publish --tag <tagname>

      Publish a new version of the package in the current working directory.



    unless upstreamUrl
      throw new Error('Package must pushed up to GitHub before publishing: https://help.github.com/articles/create-a-repo')

  # Rename package if necessary
  renamePackage: (pack, name, callback) ->
    if name?.length > 0
      message = "Renaming #{pack.name} to #{name}"
      process.stdout.write("#{message}\n")
      @setPackageName pack, name, =>
        @spawn 'git', ['add', 'package.json'], (addCode) =>
          @spawn 'git', ['commit', '-m', "#{message}"], (code, stderr='', stdout='') =>
            if code is 0 or addCode is 0
              callback()
            else
              callback('Failed to commit package.json')
    else
      # Just fall through if the name is empty
      callback()

  setPackageName: (pack, name, callback) ->
    if pack.name == name
      throw new Error('New package name matches old package name')

    pack.name = name
    @saveMetadata(pack)
    callback()

  # Run the publish command with the given options
  run: (options) ->
    {callback} = options
    options = @parseOptions(options.commandArgs)
    {tag, rename} = options.argv
    [version] = options.argv._

    try
