├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── build-workflow.sh ├── icon.png ├── info.plist ├── screenshot.png └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | alfred-crates.alfredworkflow 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "alfred" 5 | version = "4.0.1" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | dependencies = [ 8 | "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", 9 | ] 10 | 11 | [[package]] 12 | name = "alfred-crates" 13 | version = "1.0.3-alpha.0" 14 | dependencies = [ 15 | "alfred 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 16 | "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", 17 | "crates-io 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)", 18 | "curl 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)", 19 | ] 20 | 21 | [[package]] 22 | name = "autocfg" 23 | version = "0.1.4" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | 26 | [[package]] 27 | name = "backtrace" 28 | version = "0.3.30" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | dependencies = [ 31 | "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 32 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", 33 | "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 34 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 35 | "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", 36 | ] 37 | 38 | [[package]] 39 | name = "backtrace-sys" 40 | version = "0.1.28" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | dependencies = [ 43 | "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", 44 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 45 | ] 46 | 47 | [[package]] 48 | name = "bitflags" 49 | version = "1.1.0" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | 52 | [[package]] 53 | name = "byteorder" 54 | version = "1.3.2" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | 57 | [[package]] 58 | name = "bytes" 59 | version = "0.4.12" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | dependencies = [ 62 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 63 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 64 | ] 65 | 66 | [[package]] 67 | name = "cc" 68 | version = "1.0.37" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | 71 | [[package]] 72 | name = "cfg-if" 73 | version = "0.1.9" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | 76 | [[package]] 77 | name = "clap" 78 | version = "2.33.0" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | dependencies = [ 81 | "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 82 | "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 83 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 84 | ] 85 | 86 | [[package]] 87 | name = "crates-io" 88 | version = "0.24.0" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | dependencies = [ 91 | "curl 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)", 92 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 93 | "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", 94 | "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", 95 | "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", 96 | "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", 97 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 98 | ] 99 | 100 | [[package]] 101 | name = "curl" 102 | version = "0.4.22" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | dependencies = [ 105 | "curl-sys 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", 106 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 107 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 108 | "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 109 | "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", 110 | "schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", 111 | "socket2 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 112 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 113 | ] 114 | 115 | [[package]] 116 | name = "curl-sys" 117 | version = "0.4.19" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | dependencies = [ 120 | "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", 121 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 122 | "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", 123 | "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", 124 | "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 125 | "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 126 | "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 127 | ] 128 | 129 | [[package]] 130 | name = "failure" 131 | version = "0.1.5" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | dependencies = [ 134 | "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", 135 | "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 136 | ] 137 | 138 | [[package]] 139 | name = "failure_derive" 140 | version = "0.1.5" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | dependencies = [ 143 | "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 144 | "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", 145 | "syn 0.15.36 (registry+https://github.com/rust-lang/crates.io-index)", 146 | "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", 147 | ] 148 | 149 | [[package]] 150 | name = "fnv" 151 | version = "1.0.6" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | 154 | [[package]] 155 | name = "http" 156 | version = "0.1.17" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | dependencies = [ 159 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 160 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 161 | "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 162 | ] 163 | 164 | [[package]] 165 | name = "idna" 166 | version = "0.1.5" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | dependencies = [ 169 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 170 | "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 171 | "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 172 | ] 173 | 174 | [[package]] 175 | name = "iovec" 176 | version = "0.1.2" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | dependencies = [ 179 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 180 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 181 | ] 182 | 183 | [[package]] 184 | name = "itoa" 185 | version = "0.4.4" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | 188 | [[package]] 189 | name = "kernel32-sys" 190 | version = "0.2.2" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | dependencies = [ 193 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 194 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 195 | ] 196 | 197 | [[package]] 198 | name = "lazy_static" 199 | version = "1.3.0" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | 202 | [[package]] 203 | name = "libc" 204 | version = "0.2.58" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | 207 | [[package]] 208 | name = "libz-sys" 209 | version = "1.0.25" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | dependencies = [ 212 | "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", 213 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 214 | "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 215 | "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 216 | ] 217 | 218 | [[package]] 219 | name = "matches" 220 | version = "0.1.8" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | 223 | [[package]] 224 | name = "openssl-probe" 225 | version = "0.1.2" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | 228 | [[package]] 229 | name = "openssl-sys" 230 | version = "0.9.47" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | dependencies = [ 233 | "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 234 | "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", 235 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 236 | "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 237 | "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 238 | ] 239 | 240 | [[package]] 241 | name = "percent-encoding" 242 | version = "1.0.1" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | 245 | [[package]] 246 | name = "pkg-config" 247 | version = "0.3.14" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | 250 | [[package]] 251 | name = "proc-macro2" 252 | version = "0.4.30" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | dependencies = [ 255 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 256 | ] 257 | 258 | [[package]] 259 | name = "quote" 260 | version = "0.6.12" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | dependencies = [ 263 | "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 264 | ] 265 | 266 | [[package]] 267 | name = "redox_syscall" 268 | version = "0.1.54" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | 271 | [[package]] 272 | name = "rustc-demangle" 273 | version = "0.1.15" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | 276 | [[package]] 277 | name = "ryu" 278 | version = "0.2.8" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | 281 | [[package]] 282 | name = "schannel" 283 | version = "0.1.15" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | dependencies = [ 286 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 287 | "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 288 | ] 289 | 290 | [[package]] 291 | name = "serde" 292 | version = "1.0.92" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | dependencies = [ 295 | "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", 296 | ] 297 | 298 | [[package]] 299 | name = "serde_derive" 300 | version = "1.0.92" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | dependencies = [ 303 | "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 304 | "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", 305 | "syn 0.15.36 (registry+https://github.com/rust-lang/crates.io-index)", 306 | ] 307 | 308 | [[package]] 309 | name = "serde_json" 310 | version = "1.0.39" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | dependencies = [ 313 | "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 314 | "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 315 | "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", 316 | ] 317 | 318 | [[package]] 319 | name = "smallvec" 320 | version = "0.6.10" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | 323 | [[package]] 324 | name = "socket2" 325 | version = "0.3.9" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | dependencies = [ 328 | "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 330 | "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 332 | ] 333 | 334 | [[package]] 335 | name = "syn" 336 | version = "0.15.36" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | dependencies = [ 339 | "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 340 | "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", 341 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 342 | ] 343 | 344 | [[package]] 345 | name = "synstructure" 346 | version = "0.10.2" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | dependencies = [ 349 | "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 350 | "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", 351 | "syn 0.15.36 (registry+https://github.com/rust-lang/crates.io-index)", 352 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 353 | ] 354 | 355 | [[package]] 356 | name = "textwrap" 357 | version = "0.11.0" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | dependencies = [ 360 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 361 | ] 362 | 363 | [[package]] 364 | name = "unicode-bidi" 365 | version = "0.3.4" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | dependencies = [ 368 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 369 | ] 370 | 371 | [[package]] 372 | name = "unicode-normalization" 373 | version = "0.1.8" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | dependencies = [ 376 | "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 377 | ] 378 | 379 | [[package]] 380 | name = "unicode-width" 381 | version = "0.1.5" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | 384 | [[package]] 385 | name = "unicode-xid" 386 | version = "0.1.0" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | 389 | [[package]] 390 | name = "url" 391 | version = "1.7.2" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | dependencies = [ 394 | "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 395 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 396 | "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 397 | ] 398 | 399 | [[package]] 400 | name = "vcpkg" 401 | version = "0.2.6" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | 404 | [[package]] 405 | name = "winapi" 406 | version = "0.2.8" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | 409 | [[package]] 410 | name = "winapi" 411 | version = "0.3.7" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | dependencies = [ 414 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 415 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 416 | ] 417 | 418 | [[package]] 419 | name = "winapi-build" 420 | version = "0.1.1" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | 423 | [[package]] 424 | name = "winapi-i686-pc-windows-gnu" 425 | version = "0.4.0" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | 428 | [[package]] 429 | name = "winapi-x86_64-pc-windows-gnu" 430 | version = "0.4.0" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | 433 | [metadata] 434 | "checksum alfred 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6af82f5509d7451cc16f38af307524f36abe55176b0aa183b50c1f68a299fc6" 435 | "checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" 436 | "checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" 437 | "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" 438 | "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" 439 | "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" 440 | "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" 441 | "checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" 442 | "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" 443 | "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" 444 | "checksum crates-io 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49095fe6e157645809a05d3d4171b9c439bcc2b8aa0bf4322d15d35e05fd26fe" 445 | "checksum curl 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f8ed9a22aa8c4e49ac0c896279ef532a43a7df2f54fcd19fa36960de029f965f" 446 | "checksum curl-sys 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d2427916f870661c5473e41bb7a5ac08d1a01ae1a4db495f724e7b7212e40a73" 447 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 448 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 449 | "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 450 | "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" 451 | "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" 452 | "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" 453 | "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" 454 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 455 | "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" 456 | "checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" 457 | "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" 458 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 459 | "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" 460 | "checksum openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)" = "75bdd6dbbb4958d38e47a1d2348847ad1eb4dc205dc5d37473ae504391865acc" 461 | "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 462 | "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" 463 | "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 464 | "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" 465 | "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" 466 | "checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" 467 | "checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" 468 | "checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" 469 | "checksum serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be" 470 | "checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e" 471 | "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" 472 | "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" 473 | "checksum socket2 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "4e626972d3593207547f14bf5fc9efa4d0e7283deb73fef1dff313dae9ab8878" 474 | "checksum syn 0.15.36 (registry+https://github.com/rust-lang/crates.io-index)" = "8b4f551a91e2e3848aeef8751d0d4eec9489b6474c720fd4c55958d8d31a430c" 475 | "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" 476 | "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 477 | "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 478 | "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 479 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 480 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 481 | "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 482 | "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" 483 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 484 | "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" 485 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 486 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 487 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 488 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alfred-crates" 3 | version = "1.0.3-alpha.0" 4 | authors = ["François-Guillaume Ribreau "] 5 | 6 | # A short blurb about the package. This is not rendered in any format when 7 | # uploaded to crates.io (aka this is not markdown). 8 | description = "Workflow for searching Rust crates from Alfred." 9 | 10 | # These URLs point to more information about the repository. These are 11 | # intended to be webviews of the relevant data, not necessarily compatible 12 | # with VCS tools and the like. 13 | documentation = "https://docs.rs/alfred-crates" 14 | homepage = "https://github.com/FGRibreau/alfred-crates" 15 | repository = "https://github.com/FGRibreau/alfred-crates" 16 | 17 | # This points to a file in the repository (relative to this `Cargo.toml`). The 18 | # contents of this file are stored and indexed in the registry. 19 | readme = "README.md" 20 | 21 | # This is a list of up to five keywords that describe this crate. Keywords 22 | # are searchable on crates.io, and you may choose any words that would 23 | # help someone find this crate. 24 | keywords = ["cargo", "crates", "alfred", "mac"] 25 | 26 | # This is a list of up to five categories where this crate would fit. 27 | # Categories are a fixed list available at crates.io/category_slugs, and 28 | # they must match exactly. 29 | categories = ["development-tools"] 30 | 31 | # This is a string description of the license for this package. Currently 32 | # crates.io will validate the license provided against a whitelist of known 33 | # license identifiers from http://spdx.org/licenses/. Multiple licenses can be 34 | # separated with a `/`. 35 | license = "MIT" 36 | 37 | include = ["src/main.rs", "Cargo.toml", "info.plist", "info.png"] 38 | 39 | 40 | [dependencies] 41 | crates-io = "0.24" 42 | curl = "0.4.22" 43 | alfred = "4.0.1" 44 | 45 | 46 | [dependencies.clap] 47 | version = "2.20.0" 48 | default-features = false 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # alfred-crates 2 | 3 | [![Cargo version](https://img.shields.io/crates/v/alfred-crates.svg)](https://crates.io/crates/alfred-crates) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/francois-guillaume-ribreau?utm_source=github&utm_medium=button&utm_term=francois-guillaume-ribreau&utm_campaign=github) [![available-for-advisory](https://img.shields.io/badge/available%20for%20advising-yes-ff69b4.svg?)](http://bit.ly/2c7uFJq) ![extra](https://img.shields.io/badge/actively%20maintained-yes-ff69b4.svg?) [![Slack](https://img.shields.io/badge/Slack-Join%20our%20tech%20community-17202A?logo=slack)](https://join.slack.com/t/fgribreau/shared_invite/zt-edpjwt2t-Zh39mDUMNQ0QOr9qOj~jrg) 4 | 5 | Workflow for searching Rust crates from Alfred. 6 | 7 |

8 | 9 | ## Commands 10 | 11 | * `cargo {query}`: search for Rust crates 12 | 13 | ## [Download .alfredworkflow](https://github.com/FGRibreau/alfred-crates/releases/) 14 | 15 | ### Rebuild binary and alfred workflow 16 | 17 | ``` 18 | ./build-workflow.sh 19 | open alfred-crates.alfredworkflow 20 | ``` 21 | 22 | ### Additional Notes 23 | 24 | This workflow require constant internet connection. 25 | -------------------------------------------------------------------------------- /build-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | OUTPUT_FILE=alfred-crates 3 | 4 | clean (){ 5 | rm -v -rf release 6 | rm -v -rf *.alfredworkflow 7 | } 8 | 9 | clean; 10 | 11 | mkdir -p release{/,/target/release} 12 | cargo build --release 13 | 14 | # zip it 15 | zip -9 -r $OUTPUT_FILE.alfredworkflow icon.png info.plist target/release/alfred-crates 16 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FGRibreau/alfred-crates/9bd49ebc51067eea8b761929678626109451aee3/icon.png -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.fgribreau.alfredworkflow.crates 7 | category 8 | Tools 9 | connections 10 | 11 | 6C68D0BB-A89A-4FDD-BB99-B5A5B460646E 12 | 13 | 14 | destinationuid 15 | 60C09205-6FC1-4201-9FED-69858A8422D9 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | 21 | 22 | 23 | createdby 24 | Francois-Guillaume Ribreau 25 | description 26 | Workflow for searching crates on cargo.io from Alfred 27 | disabled 28 | 29 | name 30 | Rust crates search 31 | objects 32 | 33 | 34 | config 35 | 36 | concurrently 37 | 38 | escaping 39 | 102 40 | script 41 | query="{query}"; 42 | 43 | id=$(echo $query | cut -d "|" -f1) 44 | url=$(echo $query | cut -d "|" -f2) 45 | pkgstr=$(echo $query | cut -d "|" -f3) 46 | 47 | open $url 48 | type 49 | 0 50 | 51 | type 52 | alfred.workflow.output.script 53 | uid 54 | 60C09205-6FC1-4201-9FED-69858A8422D9 55 | version 56 | 0 57 | 58 | 59 | config 60 | 61 | argumenttype 62 | 0 63 | escaping 64 | 127 65 | keyword 66 | cargo 67 | queuedelaycustom 68 | 2 69 | queuedelayimmediatelyinitially 70 | 71 | queuedelaymode 72 | 2 73 | queuemode 74 | 1 75 | runningsubtext 76 | Searching for crates... 77 | script 78 | ./target/release/alfred-crates "{query}" 79 | subtext 80 | Search for Rust Crates 81 | title 82 | Cargo search 83 | type 84 | 0 85 | withspace 86 | 87 | 88 | type 89 | alfred.workflow.input.scriptfilter 90 | uid 91 | 6C68D0BB-A89A-4FDD-BB99-B5A5B460646E 92 | version 93 | 0 94 | 95 | 96 | readme 97 | See https://github.com/FGRibreau/alfred-crates 98 | uidata 99 | 100 | 60C09205-6FC1-4201-9FED-69858A8422D9 101 | 102 | ypos 103 | 110 104 | 105 | 6C68D0BB-A89A-4FDD-BB99-B5A5B460646E 106 | 107 | ypos 108 | 110 109 | 110 | 111 | webaddress 112 | fgribreau.com 113 | 114 | 115 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FGRibreau/alfred-crates/9bd49ebc51067eea8b761929678626109451aee3/screenshot.png -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate alfred; 2 | extern crate clap; 3 | extern crate crates_io; 4 | extern crate curl; 5 | 6 | use clap::{App, Arg}; 7 | use crates_io::{Crate, Registry}; 8 | use curl::easy::Easy; 9 | use std::io; 10 | 11 | const HOST: &'static str = "https://crates.io"; 12 | 13 | fn main() { 14 | // access metadata from cargo package http://stackoverflow.com/a/27841363/745121 15 | let args = App::new(env!("CARGO_PKG_NAME")) 16 | .version(env!("CARGO_PKG_VERSION")) 17 | .author(env!("CARGO_PKG_AUTHORS")) 18 | .about(env!("CARGO_PKG_DESCRIPTION")) 19 | .arg(Arg::with_name("query").short("q").required(true).index(1)) 20 | .get_matches(); 21 | 22 | let mut easy_client = Easy::new(); 23 | let useragent = [ 24 | env!("CARGO_PKG_NAME"), 25 | " (v", 26 | env!("CARGO_PKG_VERSION"), 27 | ")", 28 | ] 29 | .concat(); 30 | easy_client.useragent(useragent.as_str()).unwrap(); 31 | 32 | let query = args.value_of("query").unwrap(); 33 | let mut registry = Registry::new_handle(String::from(HOST), None, easy_client); 34 | 35 | let mut json = false; 36 | match registry.search(&query, 10) { 37 | Ok((crates, _)) => { 38 | if let Some(version) = alfred::env::version() { 39 | if version.starts_with("1") || version.starts_with("2") { 40 | // only XML support 41 | json = false; 42 | } else { 43 | // JSON support 44 | json = true; 45 | } 46 | } 47 | workflow_output(crates, json); 48 | return (); 49 | } 50 | Err(_) => { 51 | // @todo find a way in alfred to inform about the error 52 | workflow_output(vec![], json) 53 | } 54 | } 55 | } 56 | 57 | fn workflow_output(crates: Vec, json: bool) { 58 | let items = crates 59 | .into_iter() 60 | .map(|item| { 61 | let url = format!("{}/crates/{}", HOST, item.name); 62 | alfred::ItemBuilder::new(item.name) 63 | .arg(url.clone()) 64 | .quicklook_url(url) 65 | .text_large_type(item.description.clone().unwrap_or(String::from(""))) 66 | .subtitle(item.description.unwrap_or(String::from(""))) 67 | .into_item() 68 | }) 69 | .collect::>(); 70 | if json { 71 | alfred::json::Builder::with_items(&items) 72 | .write(io::stdout()) 73 | .expect("Couldn't write items to Alfred"); 74 | } else { 75 | alfred::xml::write_items(io::stdout(), &items).expect("Couldn't write items to Alfred"); 76 | } 77 | } 78 | --------------------------------------------------------------------------------