17
17
#include "logger/logger.h"
18
18
#include "parson/parson.h"
19
19
#include "registry-manager.h"
20
- #include "registry/wiki- registry.h"
20
+ #include "registry/registry.h"
21
21
#include "strdup/strdup.h"
22
22
#include "tempdir/tempdir.h"
23
23
#include "version.h"
@@ -63,7 +63,7 @@ static void setopt_json(command_t *self) { opt_json = 1; }
63
63
} \
64
64
}
65
65
66
- static int matches (int count , char * args [], wiki_package_ptr_t pkg ) {
66
+ static int matches (int count , char * args [], registry_package_ptr_t pkg ) {
67
67
// Display all packages if there's no query
68
68
if (0 == count )
69
69
return 1 ;
@@ -74,16 +74,16 @@ static int matches(int count, char *args[], wiki_package_ptr_t pkg) {
74
74
char * href = NULL ;
75
75
int rc = 0 ;
76
76
77
- name = clib_package_parse_name (wiki_package_get_id (pkg ));
77
+ name = clib_package_parse_name (registry_package_get_id (pkg ));
78
78
COMPARE (name );
79
79
80
- description = strdup (wiki_package_get_description (pkg ));
80
+ description = strdup (registry_package_get_description (pkg ));
81
81
COMPARE (description );
82
82
83
- repo = strdup (wiki_package_get_id (pkg ));
83
+ repo = strdup (registry_package_get_id (pkg ));
84
84
COMPARE (repo );
85
85
86
- href = strdup (wiki_package_get_href (pkg ));
86
+ href = strdup (registry_package_get_href (pkg ));
87
87
COMPARE (href );
88
88
89
89
cleanup :
@@ -122,26 +122,26 @@ static char *wiki_html_cache() {
122
122
}
123
123
*/
124
124
125
- static void display_package (const wiki_package_ptr_t pkg ,
125
+ static void display_package (const registry_package_ptr_t pkg ,
126
126
cc_color_t fg_color_highlight ,
127
127
cc_color_t fg_color_text ) {
128
- cc_fprintf (fg_color_highlight , stdout , " %s\n" , wiki_package_get_id (pkg ));
128
+ cc_fprintf (fg_color_highlight , stdout , " %s\n" , registry_package_get_id (pkg ));
129
129
printf (" url: " );
130
- cc_fprintf (fg_color_text , stdout , "%s\n" , wiki_package_get_href (pkg ));
130
+ cc_fprintf (fg_color_text , stdout , "%s\n" , registry_package_get_href (pkg ));
131
131
printf (" desc: " );
132
- cc_fprintf (fg_color_text , stdout , "%s\n" , wiki_package_get_description (pkg ));
132
+ cc_fprintf (fg_color_text , stdout , "%s\n" , registry_package_get_description (pkg ));
133
133
printf ("\n" );
134
134
}
135
135
136
- static void add_package_to_json (const wiki_package_ptr_t pkg ,
136
+ static void add_package_to_json (const registry_package_ptr_t pkg ,
137
137
JSON_Array * json_list ) {
138
138
JSON_Value * json_pkg_root = json_value_init_object ();
139
139
JSON_Object * json_pkg = json_value_get_object (json_pkg_root );
140
140
141
- json_object_set_string (json_pkg , "repo" , wiki_package_get_id (pkg ));
142
- json_object_set_string (json_pkg , "href" , wiki_package_get_href (pkg ));
143
- json_object_set_string (json_pkg , "description" , wiki_package_get_description (pkg ));
144
- json_object_set_string (json_pkg , "category" , wiki_package_get_category (pkg ));
141
+ json_object_set_string (json_pkg , "repo" , registry_package_get_id (pkg ));
142
+ json_object_set_string (json_pkg , "href" , registry_package_get_href (pkg ));
143
+ json_object_set_string (json_pkg , "description" , registry_package_get_description (pkg ));
144
+ json_object_set_string (json_pkg , "category" , registry_package_get_category (pkg ));
145
145
146
146
json_array_append_value (json_list , json_pkg_root );
147
147
}
@@ -198,11 +198,11 @@ int main(int argc, char *argv[]) {
198
198
*/
199
199
200
200
registry_iterator_t it = registry_iterator_new (registries );
201
- wiki_registry_ptr_t registry = NULL ;
201
+ registry_ptr_t registry = NULL ;
202
202
while ((registry = registry_iterator_next (it ))) {
203
- printf ("SEARCH: packages from %s\n" , wiki_registry_get_url (registry ));
204
- wiki_package_ptr_t pkg ;
205
- wiki_registry_iterator_t it = wiki_registry_iterator_new (registry );
203
+ printf ("SEARCH: packages from %s\n" , registry_get_url (registry ));
204
+ registry_package_ptr_t pkg ;
205
+ registry_package_iterator_t it = registry_package_iterator_new (registry );
206
206
207
207
JSON_Array * json_list = NULL ;
208
208
JSON_Value * json_list_root = NULL ;
@@ -214,15 +214,15 @@ int main(int argc, char *argv[]) {
214
214
215
215
printf ("\n" );
216
216
217
- while ((pkg = wiki_registry_iterator_next (it ))) {
217
+ while ((pkg = registry_package_iterator_next (it ))) {
218
218
if (matches (program .argc , program .argv , pkg )) {
219
219
if (opt_json ) {
220
220
add_package_to_json (pkg , json_list );
221
221
} else {
222
222
display_package (pkg , fg_color_highlight , fg_color_text );
223
223
}
224
224
} else {
225
- debug (& debugger , "skipped package %s" , wiki_package_get_id (pkg ));
225
+ debug (& debugger , "skipped package %s" , registry_package_get_id (pkg ));
226
226
}
227
227
}
228
228
@@ -234,7 +234,7 @@ int main(int argc, char *argv[]) {
234
234
json_value_free (json_list_root );
235
235
}
236
236
237
- wiki_registry_iterator_destroy (it );
237
+ registry_package_iterator_destroy (it );
238
238
}
239
239
command_free (& program );
240
240
return 0 ;
0 commit comments