]> git.mdlowis.com Git - projs/tide.git/commitdiff
added query initialization to pick command
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 30 Dec 2018 05:25:12 +0000 (00:25 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 30 Dec 2018 05:25:12 +0000 (00:25 -0500)
TODO.md
src/pick.c

diff --git a/TODO.md b/TODO.md
index 8ad4946490bf3e32b0d3c2dadce1c513c3fda283..53840dbc54069d3cc66fb88b05de280e93512b25 100644 (file)
--- 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
index 1850a94ecdff7501d2d9fafbdf3645adb1517560..acd10e80a667071a3166e449c2cafda5481d23ba 100644 (file)
@@ -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);