aboutsummaryrefslogtreecommitdiff
path: root/src/search.c
blob: 72fe350365b31c864dae2b85eee6c45455d6382a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <string.h>

#include "lua_state.h"
#include "search.h"

void search(const char* arg) {
  if (!arg) {
    for (size_t i = 0; i < cached_repos_count; i++) {
      printf("%s\n", cached_repos[i].source_key);
    }
    return;
  }
  for (size_t i = 0; i < cached_repos_count; i++) {
    if (!strstr(cached_repos[i].source_key, arg)) continue;
    printf("%s\n", cached_repos[i].source_key);
  }
}