<commit_before><?php
  namespace xp\install;

  use \util\cmd\Console;
  use \webservices\rest\RestClient;
  use \webservices\rest\RestRequest;
  use \webservices\rest\RestException;

  /**
   * XPI Installer - search modules
   * ==============================
   *
   * Basic usage
   * -----------
   * # This will search for modules
   * $ xpi search vendor
   */
  class SearchAction extends \lang\Object {

    /**
     * Execute this action
     *
     * @param  string[] $args command line args
     * @return int exit code
     */
    public function perform($args) {
      $rest= new RestClient('http://builds.planet-xp.net/');
      $request= create(new RestRequest('/search'))->withParameter('q', $args[0]);

      $i= 0;
      $results= $rest->execute($request)->data();
      foreach ($results as $result) {
        Console::writeLine(new Module($result['vendor'], $result['module']), ': ', $result['info']);
        $i++;
      }

      Console::writeLine();
      Console::writeLine($i, ' result(s) found.');
      return 0;
    }
  }
?><commit_msg>- Show URL in search results<commit_after><?php
  namespace xp\install;

  use \util\cmd\Console;
  use \webservices\rest\RestClient;
  use \webservices\rest\RestRequest;
  use \webservices\rest\RestException;

  /**
   * XPI Installer - search modules
   * ==============================
   *
   * Basic usage
   * -----------
   * # This will search for modules
   * $ xpi search vendor
   */
  class SearchAction extends \lang\Object {

    /**
     * Execute this action
     *
     * @param  string[] $args command line args
     * @return int exit code
     */
    public function perform($args) {
      $rest= new RestClient('http://builds.planet-xp.net/');
      $request= create(new RestRequest('/search'))->withParameter('q', $args[0]);

      $i= 0;
      $results= $rest->execute($request)->data();
      foreach ($results as $result) {
        Console::writeLine('+ ', new Module($result['vendor'], $result['module']), ': ', $result['info']);
        Console::writeLine('  ', $result['link']['url']);
        $i++;
      }

      Console::writeLine();
      Console::writeLine($i, ' result(s) found.');
      return 0;
    }
  }
?>
{'fraction_non_alphanumeric': 0.20009053870529653, 'fraction_numerical': 0.002716161158895428, 'mean_word_length': 2.617021276595745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3743695', 'n_tokens_mistral': 680, 'n_tokens_neox': 662, 'n_words': 150}