CmdUtils.CreateCommand({
  name: "trim",
  takes: {"url to shorten": noun_type_url},
  icon: "http://tr.im/favicon.ico",
  description: "Replaces the selected URL with a <a href=\"http://www.tr.im\">tr.im URL</a>",
  author: "chanux[at]gmail[dot]com"
  license: "GPLv3"
  preview: "Replaces the selected URL with a URL shortened with tr.im .",
  
  execute: function( urlToShorten ) {
    //escaping urlToShorten will not create the right tr.im url
    var baseUrl = "http://tr.im/api/trim_simple?url=";
    jQuery.get( baseUrl + urlToShorten.text, function( trim ) {
      CmdUtils.setSelection( trim );
      CmdUtils.copyToClipboard( trim )
    });
  }
});
