From: Michael D. Lowis Date: Sun, 30 Dec 2018 05:25:12 +0000 (-0500) Subject: added query initialization to pick command X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0ee280a81dc98c79e030c85986d919893f96dde1;p=projs%2Ftide.git added query initialization to pick command --- diff --git a/TODO.md b/TODO.md index 8ad4946..53840db 100644 --- a/TODO.md +++ b/TODO.md @@ -7,7 +7,6 @@ ## STAGING -* initialize pick query from argument * group by hostname or group env var in registrar * daemonize registrar and tide executables * Ctrl+D should not pass tag name as arg when executing tag commands diff --git a/src/pick.c b/src/pick.c index 1850a94..acd10e8 100644 --- a/src/pick.c +++ b/src/pick.c @@ -222,8 +222,14 @@ static void filter(void) { x11_event_loop(&x, redraw); } -int main(void) { +int main(int argc, char** argv) { + if (argc >= 2) { + size_t sz = min(strlen(argv[1]), sizeof(Query)-1); + strncpy(Query, argv[1], sz); + QueryIdx = sz; + } load_choices(); + score(); if (vec_size(&Choices) > 1) filter(); Choice* choice = (Choice*)vec_at(&Choices, ChoiceIdx);