├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── plugins └── cg │ └── cg.plugin.zsh ├── screenshots ├── screenshots_1.png ├── screenshots_2.png ├── screenshots_3.png └── screenshots_4.png └── src ├── api.rs ├── constant.rs ├── main.rs └── model.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.vscode -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "autocfg" 7 | version = "1.1.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 10 | 11 | [[package]] 12 | name = "base64" 13 | version = "0.21.0" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" 16 | 17 | [[package]] 18 | name = "bitflags" 19 | version = "1.3.2" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 22 | 23 | [[package]] 24 | name = "bumpalo" 25 | version = "3.12.0" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" 28 | 29 | [[package]] 30 | name = "bytes" 31 | version = "1.4.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 34 | 35 | [[package]] 36 | name = "cc" 37 | version = "1.0.79" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 40 | 41 | [[package]] 42 | name = "cfg-if" 43 | version = "1.0.0" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 46 | 47 | [[package]] 48 | name = "cg" 49 | version = "0.1.0" 50 | dependencies = [ 51 | "home", 52 | "reqwest", 53 | "rustyline", 54 | "serde", 55 | "serde_json", 56 | "tokio", 57 | ] 58 | 59 | [[package]] 60 | name = "clipboard-win" 61 | version = "4.5.0" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" 64 | dependencies = [ 65 | "error-code", 66 | "str-buf", 67 | "winapi", 68 | ] 69 | 70 | [[package]] 71 | name = "core-foundation" 72 | version = "0.9.3" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 75 | dependencies = [ 76 | "core-foundation-sys", 77 | "libc", 78 | ] 79 | 80 | [[package]] 81 | name = "core-foundation-sys" 82 | version = "0.8.3" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 85 | 86 | [[package]] 87 | name = "dirs-next" 88 | version = "2.0.0" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" 91 | dependencies = [ 92 | "cfg-if", 93 | "dirs-sys-next", 94 | ] 95 | 96 | [[package]] 97 | name = "dirs-sys-next" 98 | version = "0.1.2" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" 101 | dependencies = [ 102 | "libc", 103 | "redox_users", 104 | "winapi", 105 | ] 106 | 107 | [[package]] 108 | name = "either" 109 | version = "1.8.1" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" 112 | 113 | [[package]] 114 | name = "encoding_rs" 115 | version = "0.8.32" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" 118 | dependencies = [ 119 | "cfg-if", 120 | ] 121 | 122 | [[package]] 123 | name = "endian-type" 124 | version = "0.1.2" 125 | source = "registry+https://github.com/rust-lang/crates.io-index" 126 | checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" 127 | 128 | [[package]] 129 | name = "errno" 130 | version = "0.2.8" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" 133 | dependencies = [ 134 | "errno-dragonfly", 135 | "libc", 136 | "winapi", 137 | ] 138 | 139 | [[package]] 140 | name = "errno-dragonfly" 141 | version = "0.1.2" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 144 | dependencies = [ 145 | "cc", 146 | "libc", 147 | ] 148 | 149 | [[package]] 150 | name = "error-code" 151 | version = "2.3.1" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" 154 | dependencies = [ 155 | "libc", 156 | "str-buf", 157 | ] 158 | 159 | [[package]] 160 | name = "fastrand" 161 | version = "1.9.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 164 | dependencies = [ 165 | "instant", 166 | ] 167 | 168 | [[package]] 169 | name = "fd-lock" 170 | version = "3.0.10" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9" 173 | dependencies = [ 174 | "cfg-if", 175 | "rustix", 176 | "windows-sys 0.45.0", 177 | ] 178 | 179 | [[package]] 180 | name = "fnv" 181 | version = "1.0.7" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 184 | 185 | [[package]] 186 | name = "foreign-types" 187 | version = "0.3.2" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 190 | dependencies = [ 191 | "foreign-types-shared", 192 | ] 193 | 194 | [[package]] 195 | name = "foreign-types-shared" 196 | version = "0.1.1" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 199 | 200 | [[package]] 201 | name = "form_urlencoded" 202 | version = "1.1.0" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 205 | dependencies = [ 206 | "percent-encoding", 207 | ] 208 | 209 | [[package]] 210 | name = "futures-channel" 211 | version = "0.3.26" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" 214 | dependencies = [ 215 | "futures-core", 216 | ] 217 | 218 | [[package]] 219 | name = "futures-core" 220 | version = "0.3.26" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" 223 | 224 | [[package]] 225 | name = "futures-sink" 226 | version = "0.3.26" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" 229 | 230 | [[package]] 231 | name = "futures-task" 232 | version = "0.3.26" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" 235 | 236 | [[package]] 237 | name = "futures-util" 238 | version = "0.3.26" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" 241 | dependencies = [ 242 | "futures-core", 243 | "futures-task", 244 | "pin-project-lite", 245 | "pin-utils", 246 | ] 247 | 248 | [[package]] 249 | name = "getrandom" 250 | version = "0.2.8" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 253 | dependencies = [ 254 | "cfg-if", 255 | "libc", 256 | "wasi", 257 | ] 258 | 259 | [[package]] 260 | name = "h2" 261 | version = "0.3.16" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" 264 | dependencies = [ 265 | "bytes", 266 | "fnv", 267 | "futures-core", 268 | "futures-sink", 269 | "futures-util", 270 | "http", 271 | "indexmap", 272 | "slab", 273 | "tokio", 274 | "tokio-util", 275 | "tracing", 276 | ] 277 | 278 | [[package]] 279 | name = "hashbrown" 280 | version = "0.12.3" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 283 | 284 | [[package]] 285 | name = "home" 286 | version = "0.5.4" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" 289 | dependencies = [ 290 | "winapi", 291 | ] 292 | 293 | [[package]] 294 | name = "http" 295 | version = "0.2.9" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 298 | dependencies = [ 299 | "bytes", 300 | "fnv", 301 | "itoa", 302 | ] 303 | 304 | [[package]] 305 | name = "http-body" 306 | version = "0.4.5" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 309 | dependencies = [ 310 | "bytes", 311 | "http", 312 | "pin-project-lite", 313 | ] 314 | 315 | [[package]] 316 | name = "httparse" 317 | version = "1.8.0" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 320 | 321 | [[package]] 322 | name = "httpdate" 323 | version = "1.0.2" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 326 | 327 | [[package]] 328 | name = "hyper" 329 | version = "0.14.24" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" 332 | dependencies = [ 333 | "bytes", 334 | "futures-channel", 335 | "futures-core", 336 | "futures-util", 337 | "h2", 338 | "http", 339 | "http-body", 340 | "httparse", 341 | "httpdate", 342 | "itoa", 343 | "pin-project-lite", 344 | "socket2", 345 | "tokio", 346 | "tower-service", 347 | "tracing", 348 | "want", 349 | ] 350 | 351 | [[package]] 352 | name = "hyper-tls" 353 | version = "0.5.0" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 356 | dependencies = [ 357 | "bytes", 358 | "hyper", 359 | "native-tls", 360 | "tokio", 361 | "tokio-native-tls", 362 | ] 363 | 364 | [[package]] 365 | name = "idna" 366 | version = "0.3.0" 367 | source = "registry+https://github.com/rust-lang/crates.io-index" 368 | checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" 369 | dependencies = [ 370 | "unicode-bidi", 371 | "unicode-normalization", 372 | ] 373 | 374 | [[package]] 375 | name = "indexmap" 376 | version = "1.9.2" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" 379 | dependencies = [ 380 | "autocfg", 381 | "hashbrown", 382 | ] 383 | 384 | [[package]] 385 | name = "instant" 386 | version = "0.1.12" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 389 | dependencies = [ 390 | "cfg-if", 391 | ] 392 | 393 | [[package]] 394 | name = "io-lifetimes" 395 | version = "1.0.5" 396 | source = "registry+https://github.com/rust-lang/crates.io-index" 397 | checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" 398 | dependencies = [ 399 | "libc", 400 | "windows-sys 0.45.0", 401 | ] 402 | 403 | [[package]] 404 | name = "ipnet" 405 | version = "2.7.1" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" 408 | 409 | [[package]] 410 | name = "itoa" 411 | version = "1.0.6" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 414 | 415 | [[package]] 416 | name = "js-sys" 417 | version = "0.3.61" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" 420 | dependencies = [ 421 | "wasm-bindgen", 422 | ] 423 | 424 | [[package]] 425 | name = "lazy_static" 426 | version = "1.4.0" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 429 | 430 | [[package]] 431 | name = "libc" 432 | version = "0.2.139" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 435 | 436 | [[package]] 437 | name = "linux-raw-sys" 438 | version = "0.1.4" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" 441 | 442 | [[package]] 443 | name = "log" 444 | version = "0.4.17" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 447 | dependencies = [ 448 | "cfg-if", 449 | ] 450 | 451 | [[package]] 452 | name = "memchr" 453 | version = "2.5.0" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 456 | 457 | [[package]] 458 | name = "mime" 459 | version = "0.3.16" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 462 | 463 | [[package]] 464 | name = "mio" 465 | version = "0.8.6" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" 468 | dependencies = [ 469 | "libc", 470 | "log", 471 | "wasi", 472 | "windows-sys 0.45.0", 473 | ] 474 | 475 | [[package]] 476 | name = "native-tls" 477 | version = "0.2.11" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 480 | dependencies = [ 481 | "lazy_static", 482 | "libc", 483 | "log", 484 | "openssl", 485 | "openssl-probe", 486 | "openssl-sys", 487 | "schannel", 488 | "security-framework", 489 | "security-framework-sys", 490 | "tempfile", 491 | ] 492 | 493 | [[package]] 494 | name = "nibble_vec" 495 | version = "0.1.0" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" 498 | dependencies = [ 499 | "smallvec", 500 | ] 501 | 502 | [[package]] 503 | name = "nix" 504 | version = "0.26.2" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" 507 | dependencies = [ 508 | "bitflags", 509 | "cfg-if", 510 | "libc", 511 | "static_assertions", 512 | ] 513 | 514 | [[package]] 515 | name = "once_cell" 516 | version = "1.17.1" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 519 | 520 | [[package]] 521 | name = "openssl" 522 | version = "0.10.45" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" 525 | dependencies = [ 526 | "bitflags", 527 | "cfg-if", 528 | "foreign-types", 529 | "libc", 530 | "once_cell", 531 | "openssl-macros", 532 | "openssl-sys", 533 | ] 534 | 535 | [[package]] 536 | name = "openssl-macros" 537 | version = "0.1.0" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" 540 | dependencies = [ 541 | "proc-macro2", 542 | "quote", 543 | "syn", 544 | ] 545 | 546 | [[package]] 547 | name = "openssl-probe" 548 | version = "0.1.5" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 551 | 552 | [[package]] 553 | name = "openssl-sys" 554 | version = "0.9.80" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" 557 | dependencies = [ 558 | "autocfg", 559 | "cc", 560 | "libc", 561 | "pkg-config", 562 | "vcpkg", 563 | ] 564 | 565 | [[package]] 566 | name = "percent-encoding" 567 | version = "2.2.0" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 570 | 571 | [[package]] 572 | name = "pin-project-lite" 573 | version = "0.2.9" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 576 | 577 | [[package]] 578 | name = "pin-utils" 579 | version = "0.1.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 582 | 583 | [[package]] 584 | name = "pkg-config" 585 | version = "0.3.26" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" 588 | 589 | [[package]] 590 | name = "proc-macro2" 591 | version = "1.0.51" 592 | source = "registry+https://github.com/rust-lang/crates.io-index" 593 | checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" 594 | dependencies = [ 595 | "unicode-ident", 596 | ] 597 | 598 | [[package]] 599 | name = "quote" 600 | version = "1.0.23" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" 603 | dependencies = [ 604 | "proc-macro2", 605 | ] 606 | 607 | [[package]] 608 | name = "radix_trie" 609 | version = "0.2.1" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" 612 | dependencies = [ 613 | "endian-type", 614 | "nibble_vec", 615 | ] 616 | 617 | [[package]] 618 | name = "redox_syscall" 619 | version = "0.2.16" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 622 | dependencies = [ 623 | "bitflags", 624 | ] 625 | 626 | [[package]] 627 | name = "redox_users" 628 | version = "0.4.3" 629 | source = "registry+https://github.com/rust-lang/crates.io-index" 630 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 631 | dependencies = [ 632 | "getrandom", 633 | "redox_syscall", 634 | "thiserror", 635 | ] 636 | 637 | [[package]] 638 | name = "reqwest" 639 | version = "0.11.14" 640 | source = "registry+https://github.com/rust-lang/crates.io-index" 641 | checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" 642 | dependencies = [ 643 | "base64", 644 | "bytes", 645 | "encoding_rs", 646 | "futures-core", 647 | "futures-util", 648 | "h2", 649 | "http", 650 | "http-body", 651 | "hyper", 652 | "hyper-tls", 653 | "ipnet", 654 | "js-sys", 655 | "log", 656 | "mime", 657 | "native-tls", 658 | "once_cell", 659 | "percent-encoding", 660 | "pin-project-lite", 661 | "serde", 662 | "serde_json", 663 | "serde_urlencoded", 664 | "tokio", 665 | "tokio-native-tls", 666 | "tokio-socks", 667 | "tower-service", 668 | "url", 669 | "wasm-bindgen", 670 | "wasm-bindgen-futures", 671 | "web-sys", 672 | "winreg", 673 | ] 674 | 675 | [[package]] 676 | name = "rustix" 677 | version = "0.36.9" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" 680 | dependencies = [ 681 | "bitflags", 682 | "errno", 683 | "io-lifetimes", 684 | "libc", 685 | "linux-raw-sys", 686 | "windows-sys 0.45.0", 687 | ] 688 | 689 | [[package]] 690 | name = "rustyline" 691 | version = "11.0.0" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece" 694 | dependencies = [ 695 | "bitflags", 696 | "cfg-if", 697 | "clipboard-win", 698 | "dirs-next", 699 | "fd-lock", 700 | "libc", 701 | "log", 702 | "memchr", 703 | "nix", 704 | "radix_trie", 705 | "scopeguard", 706 | "unicode-segmentation", 707 | "unicode-width", 708 | "utf8parse", 709 | "winapi", 710 | ] 711 | 712 | [[package]] 713 | name = "ryu" 714 | version = "1.0.13" 715 | source = "registry+https://github.com/rust-lang/crates.io-index" 716 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 717 | 718 | [[package]] 719 | name = "schannel" 720 | version = "0.1.21" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" 723 | dependencies = [ 724 | "windows-sys 0.42.0", 725 | ] 726 | 727 | [[package]] 728 | name = "scopeguard" 729 | version = "1.1.0" 730 | source = "registry+https://github.com/rust-lang/crates.io-index" 731 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 732 | 733 | [[package]] 734 | name = "security-framework" 735 | version = "2.8.2" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" 738 | dependencies = [ 739 | "bitflags", 740 | "core-foundation", 741 | "core-foundation-sys", 742 | "libc", 743 | "security-framework-sys", 744 | ] 745 | 746 | [[package]] 747 | name = "security-framework-sys" 748 | version = "2.8.0" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" 751 | dependencies = [ 752 | "core-foundation-sys", 753 | "libc", 754 | ] 755 | 756 | [[package]] 757 | name = "serde" 758 | version = "1.0.152" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" 761 | dependencies = [ 762 | "serde_derive", 763 | ] 764 | 765 | [[package]] 766 | name = "serde_derive" 767 | version = "1.0.152" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" 770 | dependencies = [ 771 | "proc-macro2", 772 | "quote", 773 | "syn", 774 | ] 775 | 776 | [[package]] 777 | name = "serde_json" 778 | version = "1.0.94" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" 781 | dependencies = [ 782 | "itoa", 783 | "ryu", 784 | "serde", 785 | ] 786 | 787 | [[package]] 788 | name = "serde_urlencoded" 789 | version = "0.7.1" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 792 | dependencies = [ 793 | "form_urlencoded", 794 | "itoa", 795 | "ryu", 796 | "serde", 797 | ] 798 | 799 | [[package]] 800 | name = "slab" 801 | version = "0.4.8" 802 | source = "registry+https://github.com/rust-lang/crates.io-index" 803 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 804 | dependencies = [ 805 | "autocfg", 806 | ] 807 | 808 | [[package]] 809 | name = "smallvec" 810 | version = "1.10.0" 811 | source = "registry+https://github.com/rust-lang/crates.io-index" 812 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 813 | 814 | [[package]] 815 | name = "socket2" 816 | version = "0.4.9" 817 | source = "registry+https://github.com/rust-lang/crates.io-index" 818 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 819 | dependencies = [ 820 | "libc", 821 | "winapi", 822 | ] 823 | 824 | [[package]] 825 | name = "static_assertions" 826 | version = "1.1.0" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 829 | 830 | [[package]] 831 | name = "str-buf" 832 | version = "1.0.6" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" 835 | 836 | [[package]] 837 | name = "syn" 838 | version = "1.0.109" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 841 | dependencies = [ 842 | "proc-macro2", 843 | "quote", 844 | "unicode-ident", 845 | ] 846 | 847 | [[package]] 848 | name = "tempfile" 849 | version = "3.4.0" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" 852 | dependencies = [ 853 | "cfg-if", 854 | "fastrand", 855 | "redox_syscall", 856 | "rustix", 857 | "windows-sys 0.42.0", 858 | ] 859 | 860 | [[package]] 861 | name = "thiserror" 862 | version = "1.0.39" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" 865 | dependencies = [ 866 | "thiserror-impl", 867 | ] 868 | 869 | [[package]] 870 | name = "thiserror-impl" 871 | version = "1.0.39" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" 874 | dependencies = [ 875 | "proc-macro2", 876 | "quote", 877 | "syn", 878 | ] 879 | 880 | [[package]] 881 | name = "tinyvec" 882 | version = "1.6.0" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 885 | dependencies = [ 886 | "tinyvec_macros", 887 | ] 888 | 889 | [[package]] 890 | name = "tinyvec_macros" 891 | version = "0.1.1" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 894 | 895 | [[package]] 896 | name = "tokio" 897 | version = "1.26.0" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" 900 | dependencies = [ 901 | "autocfg", 902 | "bytes", 903 | "libc", 904 | "memchr", 905 | "mio", 906 | "pin-project-lite", 907 | "socket2", 908 | "tokio-macros", 909 | "windows-sys 0.45.0", 910 | ] 911 | 912 | [[package]] 913 | name = "tokio-macros" 914 | version = "1.8.2" 915 | source = "registry+https://github.com/rust-lang/crates.io-index" 916 | checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" 917 | dependencies = [ 918 | "proc-macro2", 919 | "quote", 920 | "syn", 921 | ] 922 | 923 | [[package]] 924 | name = "tokio-native-tls" 925 | version = "0.3.1" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 928 | dependencies = [ 929 | "native-tls", 930 | "tokio", 931 | ] 932 | 933 | [[package]] 934 | name = "tokio-socks" 935 | version = "0.5.1" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" 938 | dependencies = [ 939 | "either", 940 | "futures-util", 941 | "thiserror", 942 | "tokio", 943 | ] 944 | 945 | [[package]] 946 | name = "tokio-util" 947 | version = "0.7.7" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" 950 | dependencies = [ 951 | "bytes", 952 | "futures-core", 953 | "futures-sink", 954 | "pin-project-lite", 955 | "tokio", 956 | "tracing", 957 | ] 958 | 959 | [[package]] 960 | name = "tower-service" 961 | version = "0.3.2" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 964 | 965 | [[package]] 966 | name = "tracing" 967 | version = "0.1.37" 968 | source = "registry+https://github.com/rust-lang/crates.io-index" 969 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 970 | dependencies = [ 971 | "cfg-if", 972 | "pin-project-lite", 973 | "tracing-core", 974 | ] 975 | 976 | [[package]] 977 | name = "tracing-core" 978 | version = "0.1.30" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 981 | dependencies = [ 982 | "once_cell", 983 | ] 984 | 985 | [[package]] 986 | name = "try-lock" 987 | version = "0.2.4" 988 | source = "registry+https://github.com/rust-lang/crates.io-index" 989 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 990 | 991 | [[package]] 992 | name = "unicode-bidi" 993 | version = "0.3.10" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" 996 | 997 | [[package]] 998 | name = "unicode-ident" 999 | version = "1.0.8" 1000 | source = "registry+https://github.com/rust-lang/crates.io-index" 1001 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 1002 | 1003 | [[package]] 1004 | name = "unicode-normalization" 1005 | version = "0.1.22" 1006 | source = "registry+https://github.com/rust-lang/crates.io-index" 1007 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1008 | dependencies = [ 1009 | "tinyvec", 1010 | ] 1011 | 1012 | [[package]] 1013 | name = "unicode-segmentation" 1014 | version = "1.10.1" 1015 | source = "registry+https://github.com/rust-lang/crates.io-index" 1016 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 1017 | 1018 | [[package]] 1019 | name = "unicode-width" 1020 | version = "0.1.10" 1021 | source = "registry+https://github.com/rust-lang/crates.io-index" 1022 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1023 | 1024 | [[package]] 1025 | name = "url" 1026 | version = "2.3.1" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" 1029 | dependencies = [ 1030 | "form_urlencoded", 1031 | "idna", 1032 | "percent-encoding", 1033 | ] 1034 | 1035 | [[package]] 1036 | name = "utf8parse" 1037 | version = "0.2.0" 1038 | source = "registry+https://github.com/rust-lang/crates.io-index" 1039 | checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" 1040 | 1041 | [[package]] 1042 | name = "vcpkg" 1043 | version = "0.2.15" 1044 | source = "registry+https://github.com/rust-lang/crates.io-index" 1045 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1046 | 1047 | [[package]] 1048 | name = "want" 1049 | version = "0.3.0" 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" 1051 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1052 | dependencies = [ 1053 | "log", 1054 | "try-lock", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "wasi" 1059 | version = "0.11.0+wasi-snapshot-preview1" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1062 | 1063 | [[package]] 1064 | name = "wasm-bindgen" 1065 | version = "0.2.84" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" 1068 | dependencies = [ 1069 | "cfg-if", 1070 | "wasm-bindgen-macro", 1071 | ] 1072 | 1073 | [[package]] 1074 | name = "wasm-bindgen-backend" 1075 | version = "0.2.84" 1076 | source = "registry+https://github.com/rust-lang/crates.io-index" 1077 | checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" 1078 | dependencies = [ 1079 | "bumpalo", 1080 | "log", 1081 | "once_cell", 1082 | "proc-macro2", 1083 | "quote", 1084 | "syn", 1085 | "wasm-bindgen-shared", 1086 | ] 1087 | 1088 | [[package]] 1089 | name = "wasm-bindgen-futures" 1090 | version = "0.4.34" 1091 | source = "registry+https://github.com/rust-lang/crates.io-index" 1092 | checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" 1093 | dependencies = [ 1094 | "cfg-if", 1095 | "js-sys", 1096 | "wasm-bindgen", 1097 | "web-sys", 1098 | ] 1099 | 1100 | [[package]] 1101 | name = "wasm-bindgen-macro" 1102 | version = "0.2.84" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" 1105 | dependencies = [ 1106 | "quote", 1107 | "wasm-bindgen-macro-support", 1108 | ] 1109 | 1110 | [[package]] 1111 | name = "wasm-bindgen-macro-support" 1112 | version = "0.2.84" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" 1115 | dependencies = [ 1116 | "proc-macro2", 1117 | "quote", 1118 | "syn", 1119 | "wasm-bindgen-backend", 1120 | "wasm-bindgen-shared", 1121 | ] 1122 | 1123 | [[package]] 1124 | name = "wasm-bindgen-shared" 1125 | version = "0.2.84" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" 1128 | 1129 | [[package]] 1130 | name = "web-sys" 1131 | version = "0.3.61" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" 1134 | dependencies = [ 1135 | "js-sys", 1136 | "wasm-bindgen", 1137 | ] 1138 | 1139 | [[package]] 1140 | name = "winapi" 1141 | version = "0.3.9" 1142 | source = "registry+https://github.com/rust-lang/crates.io-index" 1143 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1144 | dependencies = [ 1145 | "winapi-i686-pc-windows-gnu", 1146 | "winapi-x86_64-pc-windows-gnu", 1147 | ] 1148 | 1149 | [[package]] 1150 | name = "winapi-i686-pc-windows-gnu" 1151 | version = "0.4.0" 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" 1153 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1154 | 1155 | [[package]] 1156 | name = "winapi-x86_64-pc-windows-gnu" 1157 | version = "0.4.0" 1158 | source = "registry+https://github.com/rust-lang/crates.io-index" 1159 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1160 | 1161 | [[package]] 1162 | name = "windows-sys" 1163 | version = "0.42.0" 1164 | source = "registry+https://github.com/rust-lang/crates.io-index" 1165 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 1166 | dependencies = [ 1167 | "windows_aarch64_gnullvm", 1168 | "windows_aarch64_msvc", 1169 | "windows_i686_gnu", 1170 | "windows_i686_msvc", 1171 | "windows_x86_64_gnu", 1172 | "windows_x86_64_gnullvm", 1173 | "windows_x86_64_msvc", 1174 | ] 1175 | 1176 | [[package]] 1177 | name = "windows-sys" 1178 | version = "0.45.0" 1179 | source = "registry+https://github.com/rust-lang/crates.io-index" 1180 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1181 | dependencies = [ 1182 | "windows-targets", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "windows-targets" 1187 | version = "0.42.1" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" 1190 | dependencies = [ 1191 | "windows_aarch64_gnullvm", 1192 | "windows_aarch64_msvc", 1193 | "windows_i686_gnu", 1194 | "windows_i686_msvc", 1195 | "windows_x86_64_gnu", 1196 | "windows_x86_64_gnullvm", 1197 | "windows_x86_64_msvc", 1198 | ] 1199 | 1200 | [[package]] 1201 | name = "windows_aarch64_gnullvm" 1202 | version = "0.42.1" 1203 | source = "registry+https://github.com/rust-lang/crates.io-index" 1204 | checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" 1205 | 1206 | [[package]] 1207 | name = "windows_aarch64_msvc" 1208 | version = "0.42.1" 1209 | source = "registry+https://github.com/rust-lang/crates.io-index" 1210 | checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" 1211 | 1212 | [[package]] 1213 | name = "windows_i686_gnu" 1214 | version = "0.42.1" 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" 1216 | checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" 1217 | 1218 | [[package]] 1219 | name = "windows_i686_msvc" 1220 | version = "0.42.1" 1221 | source = "registry+https://github.com/rust-lang/crates.io-index" 1222 | checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" 1223 | 1224 | [[package]] 1225 | name = "windows_x86_64_gnu" 1226 | version = "0.42.1" 1227 | source = "registry+https://github.com/rust-lang/crates.io-index" 1228 | checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" 1229 | 1230 | [[package]] 1231 | name = "windows_x86_64_gnullvm" 1232 | version = "0.42.1" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" 1235 | 1236 | [[package]] 1237 | name = "windows_x86_64_msvc" 1238 | version = "0.42.1" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" 1241 | 1242 | [[package]] 1243 | name = "winreg" 1244 | version = "0.10.1" 1245 | source = "registry+https://github.com/rust-lang/crates.io-index" 1246 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 1247 | dependencies = [ 1248 | "winapi", 1249 | ] 1250 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cg" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | reqwest = { version = "0.11.14", features = ["json", "socks"]} 10 | tokio = { version = "1.26.0", features = ["net", "rt", "macros"]} 11 | serde = { version = "1.0.152", features = ["derive"] } 12 | serde_json = "1.0.94" 13 | rustyline = { version = "11.0.0", features = [], optional = true } 14 | home = "0.5.4" 15 | 16 | [features] 17 | readline = ["rustyline"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChatGPT Command Generation 2 | 3 | 一个利用 ChatGPT 生成命令行的小工具 4 | 5 | A small tool that uses ChatGPT to generate a command line 6 | 7 | ## Enviroment 8 | 9 | 1. `OPENAI_API_KEY` :OpenAI API KEY 10 | 2. `HTTPS_PROXY`: A ChatGPT available proxy (optional) 11 | 12 | ## Install 13 | 14 | ```bash 15 | cargo build --release --locked 16 | ``` 17 | 18 | 或 19 | 20 | ```bash 21 | cargo install --locked --path . 22 | ``` 23 | 24 | ## zsh Plugin 25 | 26 | 1. put `/plugins/` under `$ZSH_CUSTOM` 27 | (by default: `~/.oh-my-zsh/custom/plugins/cg/cg.plugin.zsh`), 28 | 2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `.zshrc`) 29 | 30 | ```zsh 31 | plugins=( 32 | # other plugins... 33 | cg 34 | ) 35 | ``` 36 | 37 | ## Screenshots 38 | 39 | ![Screenshot 1](./screenshots/screenshots_1.png) 40 | 41 | ![Screenshot 2](./screenshots/screenshots_2.png) 42 | 43 | ![Screenshot 3](./screenshots/screenshots_3.png) 44 | 45 | ![Screenshot 4](./screenshots/screenshots_4.png) -------------------------------------------------------------------------------- /plugins/cg/cg.plugin.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | function generate() { 4 | emulate -L zsh 5 | 6 | ret=$(echo $* | cg) 7 | if [[ $? -ne 0 ]]; then 8 | return 1 9 | fi 10 | 11 | print -z $ret 12 | } 13 | 14 | type cg &> /dev/null 15 | if [[ $? -ne 0 ]]; then 16 | echo "cg not found. please install it through https://github.com/DarkHighness/ChatGPTCommandlineGeneration" 17 | return 18 | fi 19 | 20 | alias g="generate $1" -------------------------------------------------------------------------------- /screenshots/screenshots_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarkHighness/ChatGPTCommandlineGeneration/8f3586c84778799ae5925ce487dce73cbdaebe71/screenshots/screenshots_1.png -------------------------------------------------------------------------------- /screenshots/screenshots_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarkHighness/ChatGPTCommandlineGeneration/8f3586c84778799ae5925ce487dce73cbdaebe71/screenshots/screenshots_2.png -------------------------------------------------------------------------------- /screenshots/screenshots_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarkHighness/ChatGPTCommandlineGeneration/8f3586c84778799ae5925ce487dce73cbdaebe71/screenshots/screenshots_3.png -------------------------------------------------------------------------------- /screenshots/screenshots_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarkHighness/ChatGPTCommandlineGeneration/8f3586c84778799ae5925ce487dce73cbdaebe71/screenshots/screenshots_4.png -------------------------------------------------------------------------------- /src/api.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | constant::OPENAI_ENDPOINT, 3 | model::{Message, MessageRequestPayload, MessageResponsePayload, MessageRole}, 4 | }; 5 | 6 | pub struct Api { 7 | api_key: String, 8 | client: reqwest::Client, 9 | } 10 | 11 | #[derive(Debug)] 12 | pub enum ApiError { 13 | RequestError(reqwest::Error), 14 | InvalidResponseError, 15 | } 16 | 17 | impl From for ApiError { 18 | fn from(value: reqwest::Error) -> Self { 19 | ApiError::RequestError(value) 20 | } 21 | } 22 | 23 | impl Api { 24 | #[allow(dead_code)] 25 | pub fn key_from_input(api_key: &str) -> Self { 26 | Self { 27 | api_key: api_key.to_string(), 28 | client: reqwest::Client::new(), 29 | } 30 | } 31 | 32 | pub fn key_from_env() -> Self { 33 | let api_key = std::env::var("OPENAI_API_KEY") 34 | .ok() 35 | .expect("Failed to get OPENAI_API_KEY"); 36 | 37 | Self { 38 | api_key, 39 | client: reqwest::Client::new(), 40 | } 41 | } 42 | 43 | fn create_default_commandline_params(&self, user_input: &str) -> MessageRequestPayload { 44 | MessageRequestPayload { 45 | model: "gpt-3.5-turbo".to_string(), 46 | messages: vec![ 47 | Message { 48 | role: MessageRole::System, 49 | content: "Your job is give the bash commands I request. You should only output the codeblock without any extra description.".to_string() 50 | }, 51 | Message { 52 | role: MessageRole::User, 53 | content: user_input.to_string() 54 | } 55 | ], 56 | } 57 | } 58 | 59 | fn parse_response_text<'a>(&'a self, text: &'a str) -> Result { 60 | let command: Vec<&str> = text 61 | .lines() 62 | .into_iter() 63 | .skip_while(|line| *line != "```") 64 | .skip(1) 65 | .take_while(|line| *line != "```") 66 | .map(|line| line.trim()) 67 | .collect(); 68 | 69 | let command = command 70 | .into_iter() 71 | .skip_while(|line| *line == "bash") 72 | .collect::>() 73 | .join("\\\n"); 74 | 75 | if command.is_empty() { 76 | Err(ApiError::InvalidResponseError) 77 | } else { 78 | Ok(command) 79 | } 80 | } 81 | 82 | pub async fn get_commandline(&self, description: &str) -> Result { 83 | let payload = self.create_default_commandline_params(description); 84 | 85 | let body: MessageResponsePayload = self 86 | .client 87 | .post(OPENAI_ENDPOINT) 88 | .bearer_auth(&self.api_key) 89 | .header("Content-Type", "application/json") 90 | .json(&payload) 91 | .send() 92 | .await? 93 | .json() 94 | .await?; 95 | 96 | let content = body.choices.into_iter().next(); 97 | 98 | if let Some(content) = content { 99 | let command_line = content 100 | .message 101 | .content 102 | .trim(); 103 | 104 | let command_line = self.parse_response_text(command_line)?; 105 | 106 | return Ok(command_line); 107 | } 108 | 109 | Err(ApiError::InvalidResponseError) 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/constant.rs: -------------------------------------------------------------------------------- 1 | pub const OPENAI_ENDPOINT: &'static str = "https://api.openai.com/v1/chat/completions"; 2 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::fs; 2 | use std::io::Write; 3 | 4 | use api::Api; 5 | #[cfg(feature = "readline")] 6 | use rustyline::DefaultEditor; 7 | 8 | mod api; 9 | mod constant; 10 | mod model; 11 | 12 | #[cfg(feature = "readline")] 13 | fn read_user_input() -> String { 14 | let mut buffer = String::new(); 15 | let mut editor = DefaultEditor::new()?; 16 | 17 | loop { 18 | let line = editor.readline(">"); 19 | 20 | match line { 21 | Ok(line) => { 22 | buffer += &line; 23 | } 24 | Err(rustyline::error::ReadlineError::Interrupted) => break, 25 | Err(rustyline::error::ReadlineError::Eof) => break, 26 | Err(_) => { 27 | std::process::exit(1); 28 | } 29 | } 30 | } 31 | 32 | return buffer; 33 | } 34 | 35 | #[cfg(not(feature = "readline"))] 36 | fn read_user_input() -> String { 37 | use std::io::stdin; 38 | 39 | let mut input = String::new(); 40 | 41 | stdin() 42 | .read_line(&mut input) 43 | .unwrap(); 44 | 45 | input.trim().to_string() 46 | } 47 | 48 | #[tokio::main(flavor = "current_thread")] 49 | async fn main() -> Result<(), Box> { 50 | let max_retries = 5; 51 | 52 | let mut history_path = home::home_dir().expect("Unknown HOME_DIR"); 53 | history_path.push(".cg.history"); 54 | let history_path = history_path; 55 | 56 | let mut history_file = fs::File::options() 57 | .read(true) 58 | .create(true) 59 | .append(true) 60 | .open(&history_path)?; 61 | 62 | let api = Api::key_from_env(); 63 | let user_input = read_user_input(); 64 | 65 | writeln!(history_file, "{}", user_input)?; 66 | 67 | let mut retries = 0; 68 | 69 | let ret = loop { 70 | let command = api.get_commandline(&user_input).await; 71 | 72 | if let Ok(command) = command { 73 | println!("{}", command); 74 | writeln!(history_file, "{}", command)?; 75 | 76 | break Ok(()); 77 | } 78 | 79 | retries += 1; 80 | 81 | eprintln!("Retries {}/{}", retries, max_retries); 82 | 83 | if retries >= max_retries { 84 | break command.map(|_| ()); 85 | } 86 | }; 87 | 88 | if let Err(err) = ret { 89 | eprint!("{:?}", err); 90 | std::process::exit(1); 91 | } 92 | 93 | Ok(()) 94 | } 95 | -------------------------------------------------------------------------------- /src/model.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Serialize, Deserialize, Debug)] 4 | #[serde(rename_all = "lowercase")] 5 | pub enum MessageRole { 6 | System, 7 | User, 8 | Assistant, 9 | } 10 | 11 | #[derive(Serialize, Deserialize, Debug)] 12 | pub struct Message { 13 | pub role: MessageRole, 14 | pub content: String, 15 | } 16 | 17 | #[derive(Serialize, Deserialize, Debug)] 18 | pub struct MessageRequestPayload { 19 | pub model: String, 20 | pub messages: Vec, 21 | } 22 | 23 | #[derive(Serialize, Deserialize, Debug)] 24 | pub struct MessageResponseUsage { 25 | pub prompt_tokens: u32, 26 | pub completion_tokens: u32, 27 | pub total_tokens: u32, 28 | } 29 | 30 | #[derive(Serialize, Deserialize, Debug)] 31 | pub struct MessageResponseChoiceMessage { 32 | pub role: MessageRole, 33 | pub content: String, 34 | } 35 | 36 | #[derive(Serialize, Deserialize, Debug)] 37 | pub struct MessageResponseChoice { 38 | pub message: MessageResponseChoiceMessage, 39 | pub finish_reason: Option, 40 | pub index: u32, 41 | } 42 | 43 | #[derive(Serialize, Deserialize, Debug)] 44 | pub struct MessageResponsePayload { 45 | pub id: String, 46 | pub object: String, 47 | pub created: u64, 48 | pub model: String, 49 | pub usage: MessageResponseUsage, 50 | pub choices: Vec, 51 | } 52 | --------------------------------------------------------------------------------