<commit_before>#include <iostream>
#include <vector>

int main(int argc, char **argv) {
  std::vector<std::string> args(argv, argv + argc);

  if (args.size() <= 1 || (args.size() & 2) == 1) {
    std::cerr << "usage: maplabel [devlocal remote]... remotedir\n";
    return 1;
  }

  std::string curdir = args[args.size() - 1];
  for (size_t i = 1; i + 1 < args.size(); i += 2) {
    if (curdir.find(args[i + 1]) == 0 &&
        (curdir[curdir.size() - 1] == '/' ||
         curdir.size() == args[i + 1].size())) {
      std::cout << "\033];" << args[i] + curdir.substr(args[i + 1].size()) << "\007\n";
      return 0;
    }
  }

  std::cout << curdir << "\n";
  return 0;
}<commit_msg>maplabel: write to tty<commit_after>#include <fstream>
#include <iostream>
#include <vector>

int main(int argc, char **argv) {
  std::vector<std::string> args(argv, argv + argc);
  std::ofstream tty;
  tty.open("/dev/tty");

  if (args.size() <= 1 || (args.size() & 2) == 1) {
    std::cerr << "usage: maplabel [devlocal remote]... remotedir\n";
    return 1;
  }

  std::string curdir = args[args.size() - 1];
  for (size_t i = 1; i + 1 < args.size(); i += 2) {
    if (curdir.find(args[i + 1]) == 0 &&
        (curdir[curdir.size() - 1] == '/' ||
         curdir.size() == args[i + 1].size())) {
      tty << "\033];" << args[i] + curdir.substr(args[i + 1].size())
          << "\007\n";
      return 0;
    }
  }

  tty << "\033];" << curdir << "\007\n";
  return 0;
}
{'fraction_non_alphanumeric': 0.24227865477007549, 'fraction_numerical': 0.032944406314344546, 'mean_word_length': 2.6818181818181817, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 10, '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': '5583898', 'n_tokens_mistral': 619, 'n_tokens_neox': 569, 'n_words': 133}