Skip to content

Commit 3cb642a

Browse files
committed
Add update-search-index subcommand to database
1 parent bc713db commit 3cb642a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/cratesfyi.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ pub fn main() {
124124
.index(2)
125125
.help("Prefix of files in \
126126
database")))
127-
.subcommand(SubCommand::with_name("update-release-activity")))
127+
.subcommand(SubCommand::with_name("update-release-activity"))
128+
.about("Updates montly release activity \
129+
chart")
130+
.subcommand(SubCommand::with_name("update-search-index"))
131+
.about("Updates search index"))
128132
.get_matches();
129133

130134

@@ -212,6 +216,9 @@ pub fn main() {
212216
} else if let Some(_) = matches.subcommand_matches("update-release-activity") {
213217
// FIXME: This is actually util command not database
214218
cratesfyi::utils::update_release_activity().expect("Failed to update release activity");
219+
} else if let Some(_) = matches.subcommand_matches("update-search-index") {
220+
let conn = db::connect_db().unwrap();
221+
db::update_search_index(&conn).expect("Failed to update search index");
215222
}
216223
} else if let Some(matches) = matches.subcommand_matches("start-web-server") {
217224
start_web_server(Some(matches.value_of("SOCKET_ADDR").unwrap_or("0.0.0.0:3000")));

0 commit comments

Comments
 (0)