 # @param [Object] image the image to grab
 grab = (image) ->
   path = './' + config.directory + '/' + image.destination
-  log.info 'Installing image with ID ' \ 
+  log.info 'Installing image with ID ' \
     + image.id \
     + ' at resolution \'' \
     + humanResolutions[image.resolution] \


# Initialize logging
Log = require 'log-color-optionaldate'
logSettings = 
  level: 'debug'
  color: true
  date: false

  install() # Freshly install all images.
     
     
# Removes an image from installed assets.
#
# @param [Object] args the arguments to the program
#
remove = (args) ->
  id = args[3]
  images = config.images
  filteredImages = images.filter (obj) -> obj.id != args[3]
  if images.length == filteredImages.length
    log.warning 'Couldn\'t uninstall image with ID ' \
      + id \
      + ' becuse it\'s not installed in the first place.'
  else
    config.images = filteredImages
    persistConfig()
     
     
# Interpret commands.
switch process.argv[2]
  when 'install' then install()
  when 'add' then add process.argv
  when 'remove' then remove process.argv
