├── .github ├── dependabot.yml └── workflows │ ├── build.yml │ └── format.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── license ├── notes ├── code.norg └── specs.norg ├── src ├── cli.rs ├── data.rs ├── database.rs ├── fs.rs ├── git.rs ├── handle.rs ├── lockfile.rs ├── main.rs └── symlink.rs └── templates ├── cfg.jsonc └── plugin.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "cargo" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | assignees: 8 | - "shift-d" 9 | - "NTBBloodBath" 10 | commit-message: 11 | prefix: "chore(dependencies): " 12 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | linux: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: Install Rust 10 | uses: actions-rs/toolchain@v1 11 | with: 12 | toolchain: stable 13 | profile: minimal 14 | override: true 15 | - uses: Swatinem/rust-cache@v1 16 | - name: Build pnp 17 | uses: actions-rs/cargo@v1 18 | with: 19 | command: build 20 | args: --profile optimized 21 | - name: Upload pnp Linux binary 22 | uses: actions/upload-artifact@v2 23 | with: 24 | name: "pnp-linux-x86_64" 25 | path: "target/optimized/pnp" 26 | if-no-files-found: error 27 | retention-days: 7 28 | 29 | macos: 30 | runs-on: macos-latest 31 | steps: 32 | - uses: actions/checkout@v2 33 | - name: Install Rust 34 | uses: actions-rs/toolchain@v1 35 | with: 36 | toolchain: stable 37 | profile: minimal 38 | override: true 39 | - uses: Swatinem/rust-cache@v1 40 | - name: Build pnp 41 | uses: actions-rs/cargo@v1 42 | with: 43 | command: build 44 | args: --profile optimized 45 | - name: Upload pnp MacOS binary 46 | uses: actions/upload-artifact@v2 47 | with: 48 | name: "pnp-macos-x86_64" 49 | path: "target/optimized/pnp" 50 | if-no-files-found: error 51 | retention-days: 7 52 | 53 | windows: 54 | runs-on: windows-latest 55 | steps: 56 | - uses: actions/checkout@v2 57 | - name: Install Rust 58 | uses: actions-rs/toolchain@v1 59 | with: 60 | toolchain: stable 61 | profile: minimal 62 | override: true 63 | - uses: Swatinem/rust-cache@v1 64 | - name: Build pnp 65 | uses: actions-rs/cargo@v1 66 | with: 67 | command: build 68 | args: --profile optimized 69 | - name: Upload pnp Windows binary 70 | uses: actions/upload-artifact@v2 71 | with: 72 | name: "pnp-windows-x86_64.exe" 73 | path: "target\\optimized\\pnp.exe" 74 | if-no-files-found: error 75 | retention-days: 7 76 | -------------------------------------------------------------------------------- /.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | name: Format 2 | on: [push] 3 | 4 | jobs: 5 | format: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: Install Rust 10 | uses: actions-rs/toolchain@v1 11 | with: 12 | toolchain: stable 13 | profile: minimal 14 | override: true 15 | - uses: Swatinem/rust-cache@v1 16 | - name: Run cargo fmt 17 | uses: actions-rs/cargo@v1 18 | with: 19 | command: fmt 20 | - name: Commit formatted source files 21 | uses: EndBug/add-and-commit@v7 22 | with: 23 | author_name: NeoSH Format 24 | default_author: github_actions 25 | message: "refactor: formatted code" 26 | push: true 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Rust artifacts 2 | /target 3 | 4 | # local cfg.jsonc for testing purposes 5 | cfg.jsonc 6 | -------------------------------------------------------------------------------- /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 = "anyhow" 7 | version = "1.0.55" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd" 10 | 11 | [[package]] 12 | name = "atty" 13 | version = "0.2.14" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 16 | dependencies = [ 17 | "hermit-abi", 18 | "libc", 19 | "winapi", 20 | ] 21 | 22 | [[package]] 23 | name = "autocfg" 24 | version = "1.1.0" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 27 | 28 | [[package]] 29 | name = "base64" 30 | version = "0.13.0" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 33 | 34 | [[package]] 35 | name = "bitflags" 36 | version = "1.3.2" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 39 | 40 | [[package]] 41 | name = "bumpalo" 42 | version = "3.9.1" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" 45 | 46 | [[package]] 47 | name = "bytes" 48 | version = "1.1.0" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 51 | 52 | [[package]] 53 | name = "cc" 54 | version = "1.0.73" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 57 | 58 | [[package]] 59 | name = "cfg-if" 60 | version = "1.0.0" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 63 | 64 | [[package]] 65 | name = "chrono" 66 | version = "0.4.19" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" 69 | dependencies = [ 70 | "libc", 71 | "num-integer", 72 | "num-traits", 73 | "time", 74 | "winapi", 75 | ] 76 | 77 | [[package]] 78 | name = "clap" 79 | version = "3.1.1" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "6d76c22c9b9b215eeb8d016ad3a90417bd13cb24cf8142756e6472445876cab7" 82 | dependencies = [ 83 | "atty", 84 | "bitflags", 85 | "indexmap", 86 | "lazy_static", 87 | "os_str_bytes", 88 | "strsim", 89 | "termcolor", 90 | "textwrap", 91 | ] 92 | 93 | [[package]] 94 | name = "colored" 95 | version = "2.0.0" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" 98 | dependencies = [ 99 | "atty", 100 | "lazy_static", 101 | "winapi", 102 | ] 103 | 104 | [[package]] 105 | name = "core-foundation" 106 | version = "0.9.3" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 109 | dependencies = [ 110 | "core-foundation-sys", 111 | "libc", 112 | ] 113 | 114 | [[package]] 115 | name = "core-foundation-sys" 116 | version = "0.8.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 119 | 120 | [[package]] 121 | name = "dirs-next" 122 | version = "2.0.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" 125 | dependencies = [ 126 | "cfg-if", 127 | "dirs-sys-next", 128 | ] 129 | 130 | [[package]] 131 | name = "dirs-sys-next" 132 | version = "0.1.2" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" 135 | dependencies = [ 136 | "libc", 137 | "redox_users", 138 | "winapi", 139 | ] 140 | 141 | [[package]] 142 | name = "encoding_rs" 143 | version = "0.8.30" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" 146 | dependencies = [ 147 | "cfg-if", 148 | ] 149 | 150 | [[package]] 151 | name = "fastrand" 152 | version = "1.7.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" 155 | dependencies = [ 156 | "instant", 157 | ] 158 | 159 | [[package]] 160 | name = "filetime" 161 | version = "0.2.15" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" 164 | dependencies = [ 165 | "cfg-if", 166 | "libc", 167 | "redox_syscall", 168 | "winapi", 169 | ] 170 | 171 | [[package]] 172 | name = "fnv" 173 | version = "1.0.7" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 176 | 177 | [[package]] 178 | name = "foreign-types" 179 | version = "0.3.2" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 182 | dependencies = [ 183 | "foreign-types-shared", 184 | ] 185 | 186 | [[package]] 187 | name = "foreign-types-shared" 188 | version = "0.1.1" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 191 | 192 | [[package]] 193 | name = "form_urlencoded" 194 | version = "1.0.1" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 197 | dependencies = [ 198 | "matches", 199 | "percent-encoding", 200 | ] 201 | 202 | [[package]] 203 | name = "futures-channel" 204 | version = "0.3.21" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" 207 | dependencies = [ 208 | "futures-core", 209 | ] 210 | 211 | [[package]] 212 | name = "futures-core" 213 | version = "0.3.21" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" 216 | 217 | [[package]] 218 | name = "futures-sink" 219 | version = "0.3.21" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" 222 | 223 | [[package]] 224 | name = "futures-task" 225 | version = "0.3.21" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" 228 | 229 | [[package]] 230 | name = "futures-util" 231 | version = "0.3.21" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" 234 | dependencies = [ 235 | "futures-core", 236 | "futures-task", 237 | "pin-project-lite", 238 | "pin-utils", 239 | ] 240 | 241 | [[package]] 242 | name = "getrandom" 243 | version = "0.2.5" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" 246 | dependencies = [ 247 | "cfg-if", 248 | "libc", 249 | "wasi", 250 | ] 251 | 252 | [[package]] 253 | name = "h2" 254 | version = "0.3.11" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" 257 | dependencies = [ 258 | "bytes", 259 | "fnv", 260 | "futures-core", 261 | "futures-sink", 262 | "futures-util", 263 | "http", 264 | "indexmap", 265 | "slab", 266 | "tokio", 267 | "tokio-util", 268 | "tracing", 269 | ] 270 | 271 | [[package]] 272 | name = "hashbrown" 273 | version = "0.11.2" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 276 | 277 | [[package]] 278 | name = "hermit-abi" 279 | version = "0.1.19" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 282 | dependencies = [ 283 | "libc", 284 | ] 285 | 286 | [[package]] 287 | name = "http" 288 | version = "0.2.6" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" 291 | dependencies = [ 292 | "bytes", 293 | "fnv", 294 | "itoa", 295 | ] 296 | 297 | [[package]] 298 | name = "http-body" 299 | version = "0.4.4" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" 302 | dependencies = [ 303 | "bytes", 304 | "http", 305 | "pin-project-lite", 306 | ] 307 | 308 | [[package]] 309 | name = "httparse" 310 | version = "1.6.0" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" 313 | 314 | [[package]] 315 | name = "httpdate" 316 | version = "1.0.2" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 319 | 320 | [[package]] 321 | name = "hyper" 322 | version = "0.14.17" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" 325 | dependencies = [ 326 | "bytes", 327 | "futures-channel", 328 | "futures-core", 329 | "futures-util", 330 | "h2", 331 | "http", 332 | "http-body", 333 | "httparse", 334 | "httpdate", 335 | "itoa", 336 | "pin-project-lite", 337 | "socket2", 338 | "tokio", 339 | "tower-service", 340 | "tracing", 341 | "want", 342 | ] 343 | 344 | [[package]] 345 | name = "hyper-tls" 346 | version = "0.5.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 349 | dependencies = [ 350 | "bytes", 351 | "hyper", 352 | "native-tls", 353 | "tokio", 354 | "tokio-native-tls", 355 | ] 356 | 357 | [[package]] 358 | name = "idna" 359 | version = "0.2.3" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 362 | dependencies = [ 363 | "matches", 364 | "unicode-bidi", 365 | "unicode-normalization", 366 | ] 367 | 368 | [[package]] 369 | name = "indexmap" 370 | version = "1.8.0" 371 | source = "registry+https://github.com/rust-lang/crates.io-index" 372 | checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" 373 | dependencies = [ 374 | "autocfg", 375 | "hashbrown", 376 | ] 377 | 378 | [[package]] 379 | name = "instant" 380 | version = "0.1.12" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 383 | dependencies = [ 384 | "cfg-if", 385 | ] 386 | 387 | [[package]] 388 | name = "ipnet" 389 | version = "2.3.1" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" 392 | 393 | [[package]] 394 | name = "itoa" 395 | version = "1.0.1" 396 | source = "registry+https://github.com/rust-lang/crates.io-index" 397 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 398 | 399 | [[package]] 400 | name = "js-sys" 401 | version = "0.3.56" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" 404 | dependencies = [ 405 | "wasm-bindgen", 406 | ] 407 | 408 | [[package]] 409 | name = "json_comments" 410 | version = "0.2.0" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "ab25c689752fbb49903458495d3e71853229e262a2e6136325359e0705606483" 413 | 414 | [[package]] 415 | name = "lazy_static" 416 | version = "1.4.0" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 419 | 420 | [[package]] 421 | name = "libc" 422 | version = "0.2.119" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" 425 | 426 | [[package]] 427 | name = "lock_api" 428 | version = "0.4.6" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" 431 | dependencies = [ 432 | "scopeguard", 433 | ] 434 | 435 | [[package]] 436 | name = "log" 437 | version = "0.4.14" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 440 | dependencies = [ 441 | "cfg-if", 442 | ] 443 | 444 | [[package]] 445 | name = "matches" 446 | version = "0.1.9" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 449 | 450 | [[package]] 451 | name = "memchr" 452 | version = "2.4.1" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 455 | 456 | [[package]] 457 | name = "mime" 458 | version = "0.3.16" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 461 | 462 | [[package]] 463 | name = "mio" 464 | version = "0.8.0" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" 467 | dependencies = [ 468 | "libc", 469 | "log", 470 | "miow", 471 | "ntapi", 472 | "winapi", 473 | ] 474 | 475 | [[package]] 476 | name = "miow" 477 | version = "0.3.7" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 480 | dependencies = [ 481 | "winapi", 482 | ] 483 | 484 | [[package]] 485 | name = "native-tls" 486 | version = "0.2.8" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" 489 | dependencies = [ 490 | "lazy_static", 491 | "libc", 492 | "log", 493 | "openssl", 494 | "openssl-probe", 495 | "openssl-sys", 496 | "schannel", 497 | "security-framework", 498 | "security-framework-sys", 499 | "tempfile", 500 | ] 501 | 502 | [[package]] 503 | name = "ntapi" 504 | version = "0.3.7" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" 507 | dependencies = [ 508 | "winapi", 509 | ] 510 | 511 | [[package]] 512 | name = "num-integer" 513 | version = "0.1.44" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" 516 | dependencies = [ 517 | "autocfg", 518 | "num-traits", 519 | ] 520 | 521 | [[package]] 522 | name = "num-traits" 523 | version = "0.2.14" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 526 | dependencies = [ 527 | "autocfg", 528 | ] 529 | 530 | [[package]] 531 | name = "num_cpus" 532 | version = "1.13.1" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 535 | dependencies = [ 536 | "hermit-abi", 537 | "libc", 538 | ] 539 | 540 | [[package]] 541 | name = "once_cell" 542 | version = "1.9.0" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" 545 | 546 | [[package]] 547 | name = "openssl" 548 | version = "0.10.38" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" 551 | dependencies = [ 552 | "bitflags", 553 | "cfg-if", 554 | "foreign-types", 555 | "libc", 556 | "once_cell", 557 | "openssl-sys", 558 | ] 559 | 560 | [[package]] 561 | name = "openssl-probe" 562 | version = "0.1.5" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 565 | 566 | [[package]] 567 | name = "openssl-sys" 568 | version = "0.9.72" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" 571 | dependencies = [ 572 | "autocfg", 573 | "cc", 574 | "libc", 575 | "pkg-config", 576 | "vcpkg", 577 | ] 578 | 579 | [[package]] 580 | name = "os_str_bytes" 581 | version = "6.0.0" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" 584 | dependencies = [ 585 | "memchr", 586 | ] 587 | 588 | [[package]] 589 | name = "parking_lot" 590 | version = "0.12.0" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" 593 | dependencies = [ 594 | "lock_api", 595 | "parking_lot_core", 596 | ] 597 | 598 | [[package]] 599 | name = "parking_lot_core" 600 | version = "0.9.1" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" 603 | dependencies = [ 604 | "cfg-if", 605 | "libc", 606 | "redox_syscall", 607 | "smallvec", 608 | "windows-sys", 609 | ] 610 | 611 | [[package]] 612 | name = "percent-encoding" 613 | version = "2.1.0" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 616 | 617 | [[package]] 618 | name = "pin-project-lite" 619 | version = "0.2.8" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" 622 | 623 | [[package]] 624 | name = "pin-utils" 625 | version = "0.1.0" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 628 | 629 | [[package]] 630 | name = "pkg-config" 631 | version = "0.3.24" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" 634 | 635 | [[package]] 636 | name = "pnp" 637 | version = "0.1.0" 638 | dependencies = [ 639 | "anyhow", 640 | "chrono", 641 | "clap", 642 | "colored", 643 | "filetime", 644 | "json_comments", 645 | "regex", 646 | "reqwest", 647 | "serde", 648 | "serde_json", 649 | "shellexpand", 650 | "tokio", 651 | ] 652 | 653 | [[package]] 654 | name = "proc-macro2" 655 | version = "1.0.36" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" 658 | dependencies = [ 659 | "unicode-xid", 660 | ] 661 | 662 | [[package]] 663 | name = "quote" 664 | version = "1.0.15" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" 667 | dependencies = [ 668 | "proc-macro2", 669 | ] 670 | 671 | [[package]] 672 | name = "redox_syscall" 673 | version = "0.2.10" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 676 | dependencies = [ 677 | "bitflags", 678 | ] 679 | 680 | [[package]] 681 | name = "redox_users" 682 | version = "0.4.0" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" 685 | dependencies = [ 686 | "getrandom", 687 | "redox_syscall", 688 | ] 689 | 690 | [[package]] 691 | name = "regex" 692 | version = "1.5.4" 693 | source = "registry+https://github.com/rust-lang/crates.io-index" 694 | checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" 695 | dependencies = [ 696 | "regex-syntax", 697 | ] 698 | 699 | [[package]] 700 | name = "regex-syntax" 701 | version = "0.6.25" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 704 | 705 | [[package]] 706 | name = "remove_dir_all" 707 | version = "0.5.3" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 710 | dependencies = [ 711 | "winapi", 712 | ] 713 | 714 | [[package]] 715 | name = "reqwest" 716 | version = "0.11.9" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" 719 | dependencies = [ 720 | "base64", 721 | "bytes", 722 | "encoding_rs", 723 | "futures-core", 724 | "futures-util", 725 | "h2", 726 | "http", 727 | "http-body", 728 | "hyper", 729 | "hyper-tls", 730 | "ipnet", 731 | "js-sys", 732 | "lazy_static", 733 | "log", 734 | "mime", 735 | "native-tls", 736 | "percent-encoding", 737 | "pin-project-lite", 738 | "serde", 739 | "serde_json", 740 | "serde_urlencoded", 741 | "tokio", 742 | "tokio-native-tls", 743 | "url", 744 | "wasm-bindgen", 745 | "wasm-bindgen-futures", 746 | "web-sys", 747 | "winreg", 748 | ] 749 | 750 | [[package]] 751 | name = "ryu" 752 | version = "1.0.9" 753 | source = "registry+https://github.com/rust-lang/crates.io-index" 754 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 755 | 756 | [[package]] 757 | name = "schannel" 758 | version = "0.1.19" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 761 | dependencies = [ 762 | "lazy_static", 763 | "winapi", 764 | ] 765 | 766 | [[package]] 767 | name = "scopeguard" 768 | version = "1.1.0" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 771 | 772 | [[package]] 773 | name = "security-framework" 774 | version = "2.6.1" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" 777 | dependencies = [ 778 | "bitflags", 779 | "core-foundation", 780 | "core-foundation-sys", 781 | "libc", 782 | "security-framework-sys", 783 | ] 784 | 785 | [[package]] 786 | name = "security-framework-sys" 787 | version = "2.6.1" 788 | source = "registry+https://github.com/rust-lang/crates.io-index" 789 | checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" 790 | dependencies = [ 791 | "core-foundation-sys", 792 | "libc", 793 | ] 794 | 795 | [[package]] 796 | name = "serde" 797 | version = "1.0.136" 798 | source = "registry+https://github.com/rust-lang/crates.io-index" 799 | checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" 800 | dependencies = [ 801 | "serde_derive", 802 | ] 803 | 804 | [[package]] 805 | name = "serde_derive" 806 | version = "1.0.136" 807 | source = "registry+https://github.com/rust-lang/crates.io-index" 808 | checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" 809 | dependencies = [ 810 | "proc-macro2", 811 | "quote", 812 | "syn", 813 | ] 814 | 815 | [[package]] 816 | name = "serde_json" 817 | version = "1.0.79" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" 820 | dependencies = [ 821 | "itoa", 822 | "ryu", 823 | "serde", 824 | ] 825 | 826 | [[package]] 827 | name = "serde_urlencoded" 828 | version = "0.7.1" 829 | source = "registry+https://github.com/rust-lang/crates.io-index" 830 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 831 | dependencies = [ 832 | "form_urlencoded", 833 | "itoa", 834 | "ryu", 835 | "serde", 836 | ] 837 | 838 | [[package]] 839 | name = "shellexpand" 840 | version = "2.1.0" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "83bdb7831b2d85ddf4a7b148aa19d0587eddbe8671a436b7bd1182eaad0f2829" 843 | dependencies = [ 844 | "dirs-next", 845 | ] 846 | 847 | [[package]] 848 | name = "signal-hook-registry" 849 | version = "1.4.0" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 852 | dependencies = [ 853 | "libc", 854 | ] 855 | 856 | [[package]] 857 | name = "slab" 858 | version = "0.4.5" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" 861 | 862 | [[package]] 863 | name = "smallvec" 864 | version = "1.8.0" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" 867 | 868 | [[package]] 869 | name = "socket2" 870 | version = "0.4.4" 871 | source = "registry+https://github.com/rust-lang/crates.io-index" 872 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" 873 | dependencies = [ 874 | "libc", 875 | "winapi", 876 | ] 877 | 878 | [[package]] 879 | name = "strsim" 880 | version = "0.10.0" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 883 | 884 | [[package]] 885 | name = "syn" 886 | version = "1.0.86" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" 889 | dependencies = [ 890 | "proc-macro2", 891 | "quote", 892 | "unicode-xid", 893 | ] 894 | 895 | [[package]] 896 | name = "tempfile" 897 | version = "3.3.0" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 900 | dependencies = [ 901 | "cfg-if", 902 | "fastrand", 903 | "libc", 904 | "redox_syscall", 905 | "remove_dir_all", 906 | "winapi", 907 | ] 908 | 909 | [[package]] 910 | name = "termcolor" 911 | version = "1.1.2" 912 | source = "registry+https://github.com/rust-lang/crates.io-index" 913 | checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" 914 | dependencies = [ 915 | "winapi-util", 916 | ] 917 | 918 | [[package]] 919 | name = "textwrap" 920 | version = "0.14.2" 921 | source = "registry+https://github.com/rust-lang/crates.io-index" 922 | checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" 923 | 924 | [[package]] 925 | name = "time" 926 | version = "0.1.44" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 929 | dependencies = [ 930 | "libc", 931 | "wasi", 932 | "winapi", 933 | ] 934 | 935 | [[package]] 936 | name = "tinyvec" 937 | version = "1.5.1" 938 | source = "registry+https://github.com/rust-lang/crates.io-index" 939 | checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" 940 | dependencies = [ 941 | "tinyvec_macros", 942 | ] 943 | 944 | [[package]] 945 | name = "tinyvec_macros" 946 | version = "0.1.0" 947 | source = "registry+https://github.com/rust-lang/crates.io-index" 948 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 949 | 950 | [[package]] 951 | name = "tokio" 952 | version = "1.17.0" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" 955 | dependencies = [ 956 | "bytes", 957 | "libc", 958 | "memchr", 959 | "mio", 960 | "num_cpus", 961 | "once_cell", 962 | "parking_lot", 963 | "pin-project-lite", 964 | "signal-hook-registry", 965 | "socket2", 966 | "tokio-macros", 967 | "winapi", 968 | ] 969 | 970 | [[package]] 971 | name = "tokio-macros" 972 | version = "1.7.0" 973 | source = "registry+https://github.com/rust-lang/crates.io-index" 974 | checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" 975 | dependencies = [ 976 | "proc-macro2", 977 | "quote", 978 | "syn", 979 | ] 980 | 981 | [[package]] 982 | name = "tokio-native-tls" 983 | version = "0.3.0" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 986 | dependencies = [ 987 | "native-tls", 988 | "tokio", 989 | ] 990 | 991 | [[package]] 992 | name = "tokio-util" 993 | version = "0.6.9" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" 996 | dependencies = [ 997 | "bytes", 998 | "futures-core", 999 | "futures-sink", 1000 | "log", 1001 | "pin-project-lite", 1002 | "tokio", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "tower-service" 1007 | version = "0.3.1" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 1010 | 1011 | [[package]] 1012 | name = "tracing" 1013 | version = "0.1.31" 1014 | source = "registry+https://github.com/rust-lang/crates.io-index" 1015 | checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f" 1016 | dependencies = [ 1017 | "cfg-if", 1018 | "pin-project-lite", 1019 | "tracing-core", 1020 | ] 1021 | 1022 | [[package]] 1023 | name = "tracing-core" 1024 | version = "0.1.22" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23" 1027 | dependencies = [ 1028 | "lazy_static", 1029 | ] 1030 | 1031 | [[package]] 1032 | name = "try-lock" 1033 | version = "0.2.3" 1034 | source = "registry+https://github.com/rust-lang/crates.io-index" 1035 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 1036 | 1037 | [[package]] 1038 | name = "unicode-bidi" 1039 | version = "0.3.7" 1040 | source = "registry+https://github.com/rust-lang/crates.io-index" 1041 | checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" 1042 | 1043 | [[package]] 1044 | name = "unicode-normalization" 1045 | version = "0.1.19" 1046 | source = "registry+https://github.com/rust-lang/crates.io-index" 1047 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 1048 | dependencies = [ 1049 | "tinyvec", 1050 | ] 1051 | 1052 | [[package]] 1053 | name = "unicode-xid" 1054 | version = "0.2.2" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 1057 | 1058 | [[package]] 1059 | name = "url" 1060 | version = "2.2.2" 1061 | source = "registry+https://github.com/rust-lang/crates.io-index" 1062 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1063 | dependencies = [ 1064 | "form_urlencoded", 1065 | "idna", 1066 | "matches", 1067 | "percent-encoding", 1068 | ] 1069 | 1070 | [[package]] 1071 | name = "vcpkg" 1072 | version = "0.2.15" 1073 | source = "registry+https://github.com/rust-lang/crates.io-index" 1074 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1075 | 1076 | [[package]] 1077 | name = "want" 1078 | version = "0.3.0" 1079 | source = "registry+https://github.com/rust-lang/crates.io-index" 1080 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1081 | dependencies = [ 1082 | "log", 1083 | "try-lock", 1084 | ] 1085 | 1086 | [[package]] 1087 | name = "wasi" 1088 | version = "0.10.0+wasi-snapshot-preview1" 1089 | source = "registry+https://github.com/rust-lang/crates.io-index" 1090 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1091 | 1092 | [[package]] 1093 | name = "wasm-bindgen" 1094 | version = "0.2.79" 1095 | source = "registry+https://github.com/rust-lang/crates.io-index" 1096 | checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" 1097 | dependencies = [ 1098 | "cfg-if", 1099 | "wasm-bindgen-macro", 1100 | ] 1101 | 1102 | [[package]] 1103 | name = "wasm-bindgen-backend" 1104 | version = "0.2.79" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" 1107 | dependencies = [ 1108 | "bumpalo", 1109 | "lazy_static", 1110 | "log", 1111 | "proc-macro2", 1112 | "quote", 1113 | "syn", 1114 | "wasm-bindgen-shared", 1115 | ] 1116 | 1117 | [[package]] 1118 | name = "wasm-bindgen-futures" 1119 | version = "0.4.29" 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" 1121 | checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" 1122 | dependencies = [ 1123 | "cfg-if", 1124 | "js-sys", 1125 | "wasm-bindgen", 1126 | "web-sys", 1127 | ] 1128 | 1129 | [[package]] 1130 | name = "wasm-bindgen-macro" 1131 | version = "0.2.79" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" 1134 | dependencies = [ 1135 | "quote", 1136 | "wasm-bindgen-macro-support", 1137 | ] 1138 | 1139 | [[package]] 1140 | name = "wasm-bindgen-macro-support" 1141 | version = "0.2.79" 1142 | source = "registry+https://github.com/rust-lang/crates.io-index" 1143 | checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" 1144 | dependencies = [ 1145 | "proc-macro2", 1146 | "quote", 1147 | "syn", 1148 | "wasm-bindgen-backend", 1149 | "wasm-bindgen-shared", 1150 | ] 1151 | 1152 | [[package]] 1153 | name = "wasm-bindgen-shared" 1154 | version = "0.2.79" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" 1157 | 1158 | [[package]] 1159 | name = "web-sys" 1160 | version = "0.3.56" 1161 | source = "registry+https://github.com/rust-lang/crates.io-index" 1162 | checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" 1163 | dependencies = [ 1164 | "js-sys", 1165 | "wasm-bindgen", 1166 | ] 1167 | 1168 | [[package]] 1169 | name = "winapi" 1170 | version = "0.3.9" 1171 | source = "registry+https://github.com/rust-lang/crates.io-index" 1172 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1173 | dependencies = [ 1174 | "winapi-i686-pc-windows-gnu", 1175 | "winapi-x86_64-pc-windows-gnu", 1176 | ] 1177 | 1178 | [[package]] 1179 | name = "winapi-i686-pc-windows-gnu" 1180 | version = "0.4.0" 1181 | source = "registry+https://github.com/rust-lang/crates.io-index" 1182 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1183 | 1184 | [[package]] 1185 | name = "winapi-util" 1186 | version = "0.1.5" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1189 | dependencies = [ 1190 | "winapi", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "winapi-x86_64-pc-windows-gnu" 1195 | version = "0.4.0" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1198 | 1199 | [[package]] 1200 | name = "windows-sys" 1201 | version = "0.32.0" 1202 | source = "registry+https://github.com/rust-lang/crates.io-index" 1203 | checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" 1204 | dependencies = [ 1205 | "windows_aarch64_msvc", 1206 | "windows_i686_gnu", 1207 | "windows_i686_msvc", 1208 | "windows_x86_64_gnu", 1209 | "windows_x86_64_msvc", 1210 | ] 1211 | 1212 | [[package]] 1213 | name = "windows_aarch64_msvc" 1214 | version = "0.32.0" 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" 1216 | checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" 1217 | 1218 | [[package]] 1219 | name = "windows_i686_gnu" 1220 | version = "0.32.0" 1221 | source = "registry+https://github.com/rust-lang/crates.io-index" 1222 | checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" 1223 | 1224 | [[package]] 1225 | name = "windows_i686_msvc" 1226 | version = "0.32.0" 1227 | source = "registry+https://github.com/rust-lang/crates.io-index" 1228 | checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" 1229 | 1230 | [[package]] 1231 | name = "windows_x86_64_gnu" 1232 | version = "0.32.0" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" 1235 | 1236 | [[package]] 1237 | name = "windows_x86_64_msvc" 1238 | version = "0.32.0" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" 1241 | 1242 | [[package]] 1243 | name = "winreg" 1244 | version = "0.7.0" 1245 | source = "registry+https://github.com/rust-lang/crates.io-index" 1246 | checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" 1247 | dependencies = [ 1248 | "winapi", 1249 | ] 1250 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pnp" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["shift-d", "NTBBloodBath"] 6 | description = "NeoVim plugin manager built with Rust" 7 | repository = "https://github.com/nvim-plugnplay/pnp-cli" 8 | homepage = "https://github.com/nvim-plugnplay/pnp-cli" 9 | license = "GPL-3.0" 10 | include = ["src/*", "Cargo.*", "license", "templates/*"] 11 | 12 | [dependencies] 13 | colored = "2" 14 | serde_json = "1.0.79" 15 | chrono = "0.4.19" 16 | filetime = "0.2.15" 17 | anyhow = "1.0.55" 18 | regex = { version = "1.5", default-features = false, features = ["std"] } 19 | reqwest = { version = "0.11", features = ["json"] } 20 | tokio = { version = "1", features = ["full"] } 21 | clap = { version = "3.1.1", features = ["cargo"] } 22 | serde = { version = "1.0.136", features = ["derive"] } 23 | json_comments = "0.2.0" 24 | shellexpand = "2.0.0" 25 | 26 | [profile.optimized] # Size optimizations that hurt build speed 27 | inherits = "release" # Inherit from release profile 28 | opt-level = "z" # Optimize for execututable size 29 | codegen-units = 1 # Build speed -> executable size 30 | strip = true # Remove all debug symbols 31 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | 663 | -------------------------------------------------------------------------------- /notes/code.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: PNP code logic 3 | description: notes about PNP's code logic 4 | authors: shift 5 | categories: 6 | created: 2022-02-25 7 | version: 0.0.11 8 | @end 9 | 10 | * Order of things 11 | - Build `clap` cli 12 | - Get matches of cli 13 | - Start the cli logic 14 | -- If freeze flag is absent: 15 | --- Check if database.json is up to date 16 | ---- Get last modification time of remote source (github) 17 | ---- Get last modification time of local source 18 | ----- Load database.json file if not found 19 | ---- Compare modification times 20 | --- Update if necessary 21 | -- Handle cli matches 22 | 23 | * Cli arguments 24 | cli structure: 25 | `pnp ` 26 | ** General flags 27 | `--freeze` - do not update 28 | ** Subcommands 29 | *** init 30 | Initialize pnp config file inside cwd 31 | - without flags -> `cfg.jsonc` 32 | - `--plugin` -> `plugin.json` 33 | *** install 34 | Installs plugins specified inside `cfg.jsonc` inside cwd 35 | - --preview -> temporary installation of new plugins 36 | *** update 37 | Update plugins specified inside `cfg.jsonc` inside cwd 38 | - \[name\] -> plugin name 39 | *** search 40 | Search through plugin database 41 | - - part of `` (explained before) 42 | -------------------------------------------------------------------------------- /notes/specs.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: specs 3 | description: Pnp config files specification 4 | authors: shift 5 | categories: 6 | created: 2022-02-25 7 | version: 0.0.11 8 | @end 9 | 10 | * User config 11 | User's plugnplay (pnp) config is defined inside neovim config folder, in `cfg.jsonc` file. 12 | @code jsonc 13 | { 14 | "plugnplay": {}, // pnp config 15 | "plugins": {} // list of plugins and their options 16 | } 17 | @end 18 | ** cfg.plugins 19 | `plugins` is a table of `K: V` pairs. Supports following formats: 20 | > Simplified 21 | @code jsonc 22 | { 23 | "plugin_name": "plugin_location" 24 | } 25 | @end 26 | > Verbose 27 | @code jsonc 28 | { 29 | "plugin_name": { 30 | "location": "plugin_location", 31 | // plugin config options 32 | "config": "lua_string", // invalid if `config_file` exists 33 | "config_file": "lua_module", // invalid if `config` exists 34 | // plugin load options 35 | "load": { 36 | "with": "installed_plugin_name", // load when specified plugin is loaded 37 | "command": "Cmd", 38 | // or load when specified Ex command is executed 39 | "command": "Cmd{Part1, Part2}", 40 | "event": "VimEvent" // load when specified VimEvent is happening 41 | }, 42 | "version": "semver version", // install specific plugin version 43 | "branch": "remote branch", // install specific branch 44 | "commit": "commit hash", // install using specific commit hash 45 | "pin": false // whether to restrict pnp from updating this plugin 46 | } 47 | } 48 | @end 49 | In previous examples we could see `plugin_name` key and `plugin_location` value. 50 | Here, `plugin name` is how we would like to refer in our neovim config. 51 | `plugin_location` is a bit more verbose and will be described in the section below. 52 | *** plugin_location 53 | This value supports following formats: 54 | - `gh:owner/name` - GitHub repository link 55 | - `git:link` - Link to remote git repository 56 | - `ext:link` - Link to an archive (replace `ext` with archive extension) 57 | - `loc:path` - Path to a local plugin 58 | ** cfg.plugnplay 59 | This section contains pnp's config 60 | #comment TODO 61 | -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | use crate::database; 2 | use crate::handle; 3 | use clap::{arg, command, Command}; 4 | 5 | /// Generate clap cli command 6 | pub fn build() -> Command<'static> { 7 | command!() 8 | .propagate_version(true) 9 | .arg_required_else_help(true) 10 | .arg(arg!(--freeze "Do not update database.json")) 11 | .arg(arg!(--unlock "Do not update pnp.lock.json")) 12 | .subcommands(vec![ 13 | Command::new("init") 14 | .about("Intialize config files") 15 | .arg(arg!(--plugin "Initialize plugin file")), 16 | Command::new("install") 17 | .about("Install plugins") 18 | .arg(arg!(--preview "Temp installation")), 19 | Command::new("update") 20 | .about("Update plugins") 21 | .arg(arg!([name] "Plugin name")), 22 | Command::new("search") 23 | .about("Search through plugin database") 24 | .arg( 25 | arg!(--author "Filter by plugin author") 26 | .required(false) 27 | .takes_value(true), 28 | ) 29 | .arg(arg!([request] "Part of GitHub's author/name").multiple_values(true)), 30 | Command::new("info") 31 | .about("Show information about a specific plugin") 32 | .arg(arg!( "Plugin name")), 33 | Command::new("lock").about("Directly generate pnp.lock.json"), 34 | ]) 35 | } 36 | 37 | /// Handle clap cli matches 38 | pub async fn handle(matches: clap::ArgMatches) -> anyhow::Result<()> { 39 | if !&matches.is_present("freeze") { 40 | let outdated = database::is_outdated().await?; 41 | if outdated { 42 | database::load_database().await?; 43 | } 44 | } 45 | let mut ran_lock = false; 46 | let mut to_lock = false; 47 | match &matches.subcommand() { 48 | Some(("init", sub_matches)) => handle::init(sub_matches.is_present("plugin")).await?, 49 | Some(("search", sub_matches)) => { 50 | let mut author = String::new(); 51 | let should_filter_by_author = sub_matches.is_present("author"); 52 | let mut params: Vec<&str> = Vec::new(); 53 | if sub_matches.is_present("request") { 54 | params = sub_matches.values_of("request").unwrap().collect(); 55 | } 56 | if should_filter_by_author { 57 | author = sub_matches.values_of("author").unwrap().collect(); 58 | } 59 | handle::search(should_filter_by_author, &author, params)? 60 | } 61 | Some(("info", sub_matches)) => handle::info(sub_matches.value_of("name").unwrap())?, 62 | Some(("install", _)) => { 63 | handle::install().await?; 64 | to_lock = true; 65 | } 66 | // TODO: optional `name` arg 67 | Some(("update", sub_matches)) => { 68 | handle::update(sub_matches.value_of("name")).await?; 69 | to_lock = true; 70 | } 71 | Some(("lock", _)) => { 72 | crate::lockfile::Lock::new().await?.generate()?; 73 | ran_lock = true; 74 | } 75 | _ => (), 76 | } 77 | if !&matches.is_present("unlock") && !ran_lock && to_lock { 78 | crate::lockfile::Lock::new().await?.generate()?; 79 | } 80 | Ok(()) 81 | } 82 | -------------------------------------------------------------------------------- /src/data.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Error}; 2 | use serde::{Deserialize, Serialize}; 3 | use std::collections::BTreeMap; 4 | 5 | use crate::fs; 6 | use crate::git; 7 | use crate::symlink; 8 | use std::fmt; 9 | use std::fs::File; 10 | use std::io::{self, prelude::*}; 11 | 12 | #[derive(Deserialize, Debug)] 13 | pub struct ConfigStructure { 14 | pub plugnplay: BTreeMap, 15 | pub plugins: BTreeMap, 16 | } 17 | 18 | #[derive(Deserialize, Debug)] 19 | #[serde(untagged)] 20 | pub enum PluginValue { 21 | ShortHand(String), 22 | Verbose(PluginVerbose), 23 | } 24 | 25 | #[derive(Deserialize, Debug)] 26 | pub struct PluginVerbose { 27 | pub plugin_location: String, 28 | pub config: Option, 29 | pub config_file: Option, 30 | pub load: Option, 31 | pub version: Option, 32 | pub branch: Option, 33 | pub commit: Option, 34 | pub pin: Option, 35 | } 36 | 37 | #[derive(Deserialize, Serialize, Debug)] 38 | #[serde(untagged)] 39 | pub enum LazyLoadValue { 40 | Simple(String), 41 | Long(Vec), 42 | } 43 | 44 | #[derive(Deserialize, Serialize, Debug)] 45 | pub struct LazyLoad { 46 | pub with: Option, 47 | pub command: Option, 48 | pub keybind: Option, 49 | pub event: Option, 50 | pub filetype: Option, 51 | pub module: Option, 52 | } 53 | 54 | impl ConfigStructure { 55 | pub fn new() -> anyhow::Result { 56 | let config_file = File::open("./cfg.jsonc")?; 57 | let mut reader = io::BufReader::new(config_file); 58 | let mut buffer = String::new(); 59 | reader.read_to_string(&mut buffer)?; 60 | let stripped = json_comments::StripComments::new(buffer.as_bytes()); 61 | let parsed = serde_json::from_reader(stripped); 62 | parsed.context("Failed to parse cfg.jsonc") 63 | } 64 | } 65 | 66 | #[derive(Debug, Serialize, Deserialize)] 67 | #[serde(untagged)] 68 | pub enum Location { 69 | GitHub(String), 70 | Remote(String), 71 | Local(String), 72 | } 73 | 74 | impl Location { 75 | pub fn new(location: String) -> Option { 76 | match &location[0..3] { 77 | "gh:" => Some(Self::GitHub(location[3..].to_string())), 78 | "git" => Some(Self::Remote(location[4..].to_string())), 79 | "loc" => Some(Self::Local(location[4..].to_string())), 80 | &_ => None, 81 | } 82 | } 83 | fn url(&self) -> anyhow::Result { 84 | match self { 85 | Self::GitHub(repo) => Ok(format!("https://github.com/{repo}")), 86 | Self::Remote(link) => Ok(link.to_string()), 87 | _ => anyhow::private::Err(Error::msg("Unknown link format")), 88 | } 89 | } 90 | pub async fn commit_hash(&self, name: String) -> anyhow::Result> { 91 | Ok(match self { 92 | Self::GitHub(_) | Self::Remote(_) => Some(git::commit_hash(name).await?), 93 | _ => None, 94 | }) 95 | } 96 | pub async fn branch(&self, name: String) -> anyhow::Result> { 97 | Ok(match self { 98 | Self::GitHub(_) | Self::Remote(_) => Some(git::branch(name).await?), 99 | _ => None, 100 | }) 101 | } 102 | pub fn is_git(&self) -> bool { 103 | match self { 104 | Self::GitHub(_) | Self::Remote(_) => true, 105 | _ => false, 106 | } 107 | } 108 | fn sym_path(&self, name: String) -> Option { 109 | match self { 110 | Self::Local(_) => Some(git::append_to_data(&format!("/site/pack/pnp/opt/{name}"))), 111 | _ => None, 112 | } 113 | } 114 | // TODO: key is the same, value is different 115 | pub async fn install(&self, name: String) -> anyhow::Result<()> { 116 | let dir = crate::git::append_to_data(&format!("/site/pack/pnp/opt/{name}")); 117 | let exists = fs::Exists::new(&dir); 118 | if exists.path { 119 | Ok(()) 120 | } else if let Self::Local(path) = self { 121 | let target = self.sym_path(name).unwrap(); 122 | symlink::SymLink::new(path.into(), target).create().await?; 123 | Ok(()) 124 | } else { 125 | let url = self.url()?; 126 | if exists.git { 127 | Ok(()) 128 | } else { 129 | crate::git::clone(url, name).await?; 130 | Ok(()) 131 | } 132 | } 133 | } 134 | 135 | pub async fn update(&self, name: String) -> anyhow::Result<()> { 136 | if let Self::Local(_) = self { 137 | return Ok(()); 138 | } 139 | let url = self.url()?; 140 | let dir = crate::git::append_to_data(&format!("/site/pack/pnp/opt/{name}")); 141 | let exists = fs::Exists::new(&dir); 142 | if !exists.path { 143 | crate::git::clone(url, name).await?; 144 | } else if !exists.git { 145 | unimplemented!(".git does not exist"); 146 | } else { 147 | crate::git::update(name).await?; 148 | } 149 | 150 | Ok(()) 151 | } 152 | } 153 | 154 | impl fmt::Display for Location { 155 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 156 | match self { 157 | Self::GitHub(data) | Self::Remote(data) | Self::Local(data) => { 158 | write!(f, "{data}") 159 | } 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/database.rs: -------------------------------------------------------------------------------- 1 | use filetime::FileTime; 2 | use reqwest::Client; 3 | use serde_json::{from_reader, Value}; 4 | use std::collections::HashMap; 5 | use std::fs::File; 6 | use std::io::BufReader; 7 | 8 | use crate::fs; 9 | 10 | const DATABASE_COMMITS_LINK: &str = "https://api.github.com/repos/nvim-plugnplay/database/commits?path=database.json&page=1&per_page=1"; 11 | const DATABASE_RAW_LINK: &str = 12 | "https://raw.githubusercontent.com/nvim-plugnplay/database/main/database.json"; 13 | 14 | // Custom HashMap type so we can iterate over our database 15 | pub type JsonMap = HashMap; 16 | 17 | /// Get last modification time of database.json from remote source 18 | async fn fetch_remote_updatetime() -> anyhow::Result { 19 | let client = Client::builder() 20 | .user_agent("plugnplay.nvim/0.1.0") 21 | .build()?; 22 | let resp = client 23 | .get(DATABASE_COMMITS_LINK) 24 | .send() 25 | .await? 26 | .text() 27 | .await?; 28 | let parsed: Value = serde_json::from_str(&resp)?; 29 | let raw_remote = parsed[0]["commit"]["committer"]["date"].to_string(); 30 | let time_remote = chrono::NaiveDateTime::parse_from_str(&raw_remote, "\"%+\"")?; 31 | Ok(time_remote.timestamp()) 32 | } 33 | 34 | /// Get last modification time of database.json from local source 35 | async fn fetch_local_updatetime() -> anyhow::Result { 36 | let path = format!("{}/pnp/database.json", fs::Manager::cache()?,); 37 | let prev_metadata = std::fs::metadata(&path); 38 | let metadata = match prev_metadata { 39 | Ok(data) => data, 40 | Err(e) => { 41 | if e.kind() == std::io::ErrorKind::NotFound { 42 | load_database().await?; 43 | std::fs::metadata(&path)? // I guess if we have error on this stage we can just `?` it 44 | } else { 45 | panic!("{e:?}"); 46 | } 47 | } 48 | }; 49 | Ok(FileTime::from_last_modification_time(&metadata).unix_seconds()) 50 | } 51 | 52 | /// Download database.json 53 | pub async fn load_database() -> anyhow::Result<()> { 54 | println!("Updating database..."); 55 | let dir = format!("{}/pnp", fs::Manager::cache()?); 56 | let path = format!("{}/{}", &dir, &"/database.json"); 57 | let client = Client::new(); 58 | let resp = client.get(DATABASE_RAW_LINK).send().await?.bytes().await?; 59 | std::fs::create_dir_all(dir)?; 60 | let mut file = std::fs::File::create(path)?; 61 | let mut content = std::io::Cursor::new(resp); 62 | std::io::copy(&mut content, &mut file)?; 63 | println!("Database is up to date!"); 64 | 65 | Ok(()) 66 | } 67 | 68 | /// Check if database.json is outdated based on last modification time 69 | pub async fn is_outdated() -> anyhow::Result { 70 | Ok(fetch_remote_updatetime().await? > fetch_local_updatetime().await?) 71 | } 72 | 73 | /// Retrieve local database path 74 | pub fn get_database_path() -> anyhow::Result { 75 | let path = format!("{}/{}", fs::Manager::cache()?, "pnp/database.json"); 76 | Ok(path) 77 | } 78 | 79 | /// Get the local database contents 80 | pub fn read_database() -> anyhow::Result { 81 | // Get the database path and open database if exists 82 | let pnp_database = match get_database_path() { 83 | Ok(database) => File::open(database)?, 84 | Err(e) => { 85 | panic!("{e:?}"); 86 | } 87 | }; 88 | // Read database contents and convert it to a string 89 | let buf_reader = BufReader::new(pnp_database); 90 | // Deserialize JSON database from reader 91 | let database_json: JsonMap = from_reader(buf_reader)?; 92 | Ok(database_json) 93 | } 94 | -------------------------------------------------------------------------------- /src/fs.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::path::Path; 3 | 4 | pub struct Exists { 5 | pub path: bool, 6 | pub git: bool, 7 | } 8 | 9 | impl Exists { 10 | pub fn new(path: &str) -> Self { 11 | Self { 12 | path: Path::new(path).exists(), 13 | git: Path::new(&format!("{path}/.git")).exists(), 14 | } 15 | } 16 | } 17 | 18 | pub struct Manager; 19 | 20 | #[cfg(target_family = "windows")] 21 | impl Manager { 22 | pub fn data() -> anyhow::Result { 23 | let local = env::var("localappdata")?; 24 | Ok(format!("{local}/nvim-data")) 25 | } 26 | pub fn config() -> anyhow::Result { 27 | let xdg = env::var("xdg_config_home"); 28 | if let Ok(dir) = xdg { 29 | Ok(format!("{dir}/nvim")) 30 | } else { 31 | let local = env::var("localappdata")?; 32 | Ok(format!("{local}/nvim")) 33 | } 34 | } 35 | pub fn cache() -> anyhow::Result { 36 | let roam = env::var("appdata")?; 37 | Ok(format!("{roam}/pnp")) 38 | } 39 | } 40 | 41 | #[cfg(target_family = "unix")] 42 | impl Manager { 43 | pub fn data() -> anyhow::Result { 44 | let share = shellexpand::tilde("~/.local/share"); 45 | Ok(format!("{share}/nvim")) 46 | } 47 | pub fn config() -> anyhow::Result { 48 | let xdg = env::var("xdg_config_home"); 49 | if let Ok(dir) = xdg { 50 | Ok(format!("{dir}/nvim")) 51 | } else { 52 | let config = shellexpand::tilde("~/.config"); 53 | Ok(format!("{config}/nvim")) 54 | } 55 | } 56 | pub fn cache() -> anyhow::Result { 57 | let cache = shellexpand::tilde("~/.cache"); 58 | Ok(format!("{cache}/pnp")) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/git.rs: -------------------------------------------------------------------------------- 1 | use tokio::{ 2 | io::{AsyncBufReadExt, BufReader}, 3 | process::Command, 4 | }; 5 | 6 | use std::process::Stdio; 7 | 8 | use crate::fs; 9 | 10 | pub fn append_to_data(append: &str) -> String { 11 | let nvim_data = fs::Manager::data().unwrap(); 12 | 13 | nvim_data + append 14 | } 15 | 16 | pub async fn clone(url: String, dir_name: String) -> anyhow::Result<()> { 17 | let data_appendix = format!("/site/pack/pnp/opt/{dir_name}"); 18 | let dir = append_to_data(&data_appendix); 19 | let mut cmd = Command::new("git"); 20 | cmd.args(&["clone", &url, "--depth=1", &dir]) 21 | .stdout(Stdio::piped()); 22 | let mut child = cmd.spawn()?; 23 | let _ = child.wait().await; 24 | 25 | Ok(()) 26 | } 27 | 28 | pub async fn update(dir_name: String) -> anyhow::Result<()> { 29 | let data_appendix = format!("/site/pack/pnp/opt/{dir_name}"); 30 | let dir = append_to_data(&data_appendix); 31 | let mut cmd = Command::new("git"); 32 | cmd.args(&["pull", "origin", "main"]) 33 | .current_dir(dir) 34 | .stdout(Stdio::piped()); 35 | let mut child = cmd.spawn()?; 36 | let _ = child.wait().await; 37 | 38 | Ok(()) 39 | } 40 | 41 | pub async fn commit_hash(dir_name: String) -> anyhow::Result { 42 | let data_appendix = format!("/site/pack/pnp/opt/{dir_name}"); 43 | let dir = append_to_data(&data_appendix); 44 | let mut cmd = Command::new("git"); 45 | cmd.args(&["rev-parse", "HEAD"]) 46 | .current_dir(dir) 47 | .stdout(Stdio::piped()); 48 | let mut child = cmd.spawn()?; 49 | let stdout = child.stdout.take().unwrap(); 50 | let mut reader = BufReader::new(stdout).lines(); 51 | 52 | if let Some(line) = reader.next_line().await? { 53 | Ok(line) 54 | } else { 55 | Err(anyhow::format_err!("Could not read commit hash")) 56 | } 57 | } 58 | 59 | pub async fn branch(dir_name: String) -> anyhow::Result { 60 | let data_appendix = format!("/site/pack/pnp/opt/{dir_name}"); 61 | let dir = append_to_data(&data_appendix); 62 | let mut cmd = Command::new("git"); 63 | cmd.args(&["rev-parse", "--abbrev-ref", "HEAD"]) 64 | .current_dir(dir) 65 | .stdout(Stdio::piped()); 66 | let mut child = cmd.spawn()?; 67 | let stdout = child.stdout.take().unwrap(); 68 | let mut reader = BufReader::new(stdout).lines(); 69 | 70 | if let Some(line) = reader.next_line().await? { 71 | Ok(line) 72 | } else { 73 | Err(anyhow::format_err!("Could not read current branch")) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/handle.rs: -------------------------------------------------------------------------------- 1 | use crate::data::*; 2 | use colored::*; 3 | use regex::RegexSet; 4 | use std::fs::File; 5 | use std::io::Write; 6 | 7 | use crate::database::{self, JsonMap}; 8 | 9 | const PLUGIN_CONTENT: &str = include_str!("../templates/plugin.json"); 10 | const CONFIG_CONTENT: &str = include_str!("../templates/cfg.jsonc"); 11 | 12 | /// `pnp init` logic 13 | pub async fn init(toggle: bool) -> anyhow::Result<()> { 14 | if toggle { 15 | let mut output = File::create("./plugin.json")?; 16 | write!(output, "{PLUGIN_CONTENT}")?; 17 | } else { 18 | let mut output = File::create("./cfg.jsonc")?; 19 | write!(output, "{CONFIG_CONTENT}")?; 20 | install().await?; 21 | } 22 | Ok(()) 23 | } 24 | 25 | /// `pnp install` logic 26 | pub async fn install() -> anyhow::Result<()> { 27 | let parsed_contents = ConfigStructure::new()?; 28 | for (name, value) in parsed_contents.plugins { 29 | let location = match value { 30 | PluginValue::ShortHand(loc) => loc, 31 | PluginValue::Verbose(verbose) => verbose.plugin_location, 32 | }; 33 | let parsed_location = Location::new(location).expect("Unknown format of plugin_location"); 34 | parsed_location.install(name).await?; 35 | } 36 | 37 | Ok(()) 38 | } 39 | 40 | /// `pnp update` logic 41 | pub async fn update(name: Option<&str>) -> anyhow::Result<()> { 42 | let parsed_contents = ConfigStructure::new()?; 43 | if let Some(dir_name) = name { 44 | let location = match &parsed_contents.plugins[dir_name] { 45 | PluginValue::ShortHand(loc) => loc, 46 | PluginValue::Verbose(verbose) => &verbose.plugin_location, 47 | }; 48 | let parsed_location = 49 | Location::new(location.into()).expect("Unknown format of plugin_location"); 50 | parsed_location.update(dir_name.to_string()).await?; 51 | println!() 52 | } else { 53 | for (name, value) in parsed_contents.plugins { 54 | let location = match value { 55 | PluginValue::ShortHand(loc) => loc, 56 | PluginValue::Verbose(verbose) => verbose.plugin_location, 57 | }; 58 | let parsed_location = 59 | Location::new(location).expect("Unknown format of plugin_location"); 60 | parsed_location.update(name).await?; 61 | println!(); 62 | } 63 | } 64 | 65 | Ok(()) 66 | } 67 | 68 | /// `pnp search` logic 69 | pub fn search(filter_by_author: bool, author_name: &str, params: Vec<&str>) -> anyhow::Result<()> { 70 | let database_json: JsonMap = database::read_database()?; 71 | 72 | // Iterate over all plugins and filter based on search arguments 73 | let search_params = RegexSet::new(¶ms)?; 74 | for (plugin, metadata) in database_json.iter() { 75 | let author = metadata["owner"]["login"].as_str().unwrap(); 76 | let author_and_sep = author.to_owned() + "/"; 77 | let description = metadata["description"] 78 | .as_str() 79 | .unwrap_or("No description available"); 80 | 81 | let desc_matches = search_params.matches(description); 82 | let name_matches = search_params.matches(plugin); 83 | if ((params[0] == plugin) 84 | || (name_matches.into_iter().count() == params.len()) 85 | || (desc_matches.into_iter().count() == params.len())) 86 | && ((author == author_name) || !filter_by_author) 87 | { 88 | println!( 89 | "{}{}\n\t{}\n", 90 | author_and_sep.purple().bold(), 91 | plugin.bold(), 92 | description 93 | ) 94 | } 95 | } 96 | 97 | Ok(()) 98 | } 99 | 100 | // `pnp info` logic 101 | pub fn info(plugin_name: &str) -> anyhow::Result<()> { 102 | let database_json: JsonMap = database::read_database()?; 103 | 104 | let plugin = database_json.get_key_value(plugin_name); 105 | for (_, metadata) in plugin.iter() { 106 | // Metadata we want to extract: 107 | // - description 108 | // - clone_url 109 | // - maintainer (repository owner) 110 | // - updated_at (YYYY-MM-DD HH:MM:SS, we will replace some chars) 111 | // - stargazers 112 | // - forks_count 113 | // - topics 114 | // - license (missing field, remote database isn't updated with this field) 115 | // - size (missing field, not implemented yet) 116 | let repo = metadata["clone_url"].as_str().unwrap().replace(".git", ""); 117 | let maintainer = metadata["owner"]["login"].as_str().unwrap(); 118 | let description = metadata["description"] 119 | .as_str() 120 | .unwrap_or("No description available"); 121 | let stars_count = metadata["stargazers_count"].as_u64().unwrap(); 122 | let forks_count = metadata["forks_count"].as_u64().unwrap(); 123 | let updated_date = metadata["updated_at"] 124 | .as_str() 125 | .unwrap() 126 | .replace('T', " ") 127 | .replace('Z', ""); 128 | let topics_arr = metadata["topics"].as_array().unwrap(); 129 | 130 | // Get topics from JSON topics array 131 | let mut topics: Vec<&str> = Vec::new(); 132 | for topic in topics_arr { 133 | topics.push(topic.as_str().unwrap()); 134 | } 135 | 136 | println!("{} {}", "Maintainer\t:".bold(), maintainer); 137 | println!("{} {}", "Repository\t:".bold(), repo); 138 | println!("{} {}", "Description\t:".bold(), description); 139 | println!("{} {}", "Topics\t\t:".bold(), topics.join(", ")); 140 | println!("{} {}", "Stars count\t:".bold(), stars_count); 141 | println!("{} {}", "Forks count\t:".bold(), forks_count); 142 | println!("{} {}", "Latest update\t:".bold(), updated_date); 143 | } 144 | 145 | Ok(()) 146 | } 147 | -------------------------------------------------------------------------------- /src/lockfile.rs: -------------------------------------------------------------------------------- 1 | use crate::data; 2 | use serde::{Deserialize, Serialize}; 3 | use std::collections::BTreeMap; 4 | use std::fs; 5 | 6 | #[derive(Debug, Serialize, Deserialize)] 7 | pub struct Lock(BTreeMap); 8 | #[derive(Debug, Serialize, Deserialize)] 9 | struct PlugItem { 10 | location: data::Location, 11 | branch: Option, 12 | commit_hash: Option, 13 | pinned_commit_hash: Option, 14 | pin: bool, 15 | version: Option, 16 | lazy_load: Option, 17 | configuration: Option, 18 | } 19 | 20 | macro_rules! init { 21 | ( $( $v:ident, $t:ty ), * ) => { 22 | $( 23 | #[allow(unused_mut)] 24 | let mut $v: Option<$t> = None; 25 | )* 26 | } 27 | } 28 | 29 | impl PlugItem { 30 | async fn new( 31 | name: String, 32 | value: data::PluginValue, 33 | previous_lockfile: &anyhow::Result, 34 | ) -> anyhow::Result { 35 | init! { 36 | branch, String, 37 | commit_hash, String, 38 | pinned_commit_hash, String, 39 | version, String, 40 | lazy_load, data::LazyLoad, 41 | configuration, ConfigType 42 | } 43 | let mut pin = false; 44 | let location = match value { 45 | data::PluginValue::ShortHand(loc_string) => data::Location::new(loc_string).unwrap(), 46 | data::PluginValue::Verbose(verbose) => { 47 | branch = verbose.branch; 48 | pinned_commit_hash = verbose.commit; 49 | pin = verbose.pin.unwrap_or(false); 50 | version = verbose.version; 51 | lazy_load = verbose.load; 52 | configuration = { 53 | if let Some(chunk) = verbose.config { 54 | Some(ConfigType::Chunk(chunk)) 55 | } else { 56 | verbose.config_file.map(ConfigType::Module) 57 | } 58 | }; 59 | 60 | data::Location::new(verbose.plugin_location).unwrap() 61 | } 62 | }; 63 | if location.is_git() { 64 | commit_hash = location.commit_hash(name.clone()).await?; 65 | match branch { 66 | Some(_) => (), 67 | None => { 68 | if let Ok(lock) = previous_lockfile { 69 | match &lock.0.get(&name) { 70 | Some(item) => { 71 | if item.branch.is_some() { 72 | branch = item.branch.clone(); 73 | } 74 | } 75 | None => { 76 | branch = location.branch(name.clone()).await?; 77 | } 78 | } 79 | } else { 80 | branch = location.branch(name.clone()).await?; 81 | } 82 | } 83 | } 84 | } 85 | Ok(Self { 86 | location, 87 | branch, 88 | commit_hash, 89 | pinned_commit_hash, 90 | pin, 91 | version, 92 | lazy_load, 93 | configuration, 94 | }) 95 | } 96 | } 97 | 98 | #[derive(Debug, Serialize, Deserialize)] 99 | enum ConfigType { 100 | Chunk(String), 101 | Module(String), 102 | } 103 | 104 | impl Lock { 105 | pub async fn new() -> anyhow::Result { 106 | let mut plugitems: BTreeMap = BTreeMap::new(); 107 | let cfg = data::ConfigStructure::new()?; 108 | let plugins = cfg.plugins; 109 | let previous_lockfile = Self::load(); 110 | for (name, plugin_value) in plugins { 111 | plugitems.insert( 112 | name.clone(), 113 | PlugItem::new(name, plugin_value, &previous_lockfile).await?, 114 | ); 115 | } 116 | 117 | Ok(Self(plugitems)) 118 | } 119 | 120 | pub fn generate(&self) -> anyhow::Result<()> { 121 | let lockfile = fs::File::create("./pnp.lock.json")?; 122 | serde_json::to_writer_pretty(lockfile, &self)?; 123 | Ok(()) 124 | } 125 | 126 | pub fn load() -> anyhow::Result { 127 | let lockfile_raw = fs::File::open("./pnp.lock.json")?; 128 | Ok(serde_json::from_reader(lockfile_raw)?) 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod cli; 2 | mod data; 3 | mod database; 4 | mod fs; 5 | mod git; 6 | mod handle; 7 | mod lockfile; 8 | mod symlink; 9 | 10 | #[tokio::main] 11 | async fn main() -> anyhow::Result<()> { 12 | let cmd = cli::build(); 13 | let matches = cmd.get_matches(); 14 | cli::handle(matches).await?; 15 | Ok(()) 16 | } 17 | -------------------------------------------------------------------------------- /src/symlink.rs: -------------------------------------------------------------------------------- 1 | use std::process::Stdio; 2 | use tokio::{ 3 | io::{AsyncBufReadExt, BufReader}, 4 | process::Command, 5 | }; 6 | 7 | // TODO: check if symlink can be created (path exists) 8 | pub struct SymLink { 9 | path: String, 10 | target: String, 11 | cmd: Option, 12 | } 13 | 14 | impl SymLink { 15 | pub fn new(path: String, target: String) -> Self { 16 | Self { 17 | path, 18 | target, 19 | cmd: None, 20 | } 21 | } 22 | 23 | #[cfg(target_family = "windows")] 24 | fn cmd(&mut self) { 25 | let mut cmd = Command::new("cmd"); 26 | let path = shellexpand::tilde(&self.path) 27 | .to_string() 28 | .replace('/', "\\"); 29 | let target = self.target.replace('/', "\\"); 30 | cmd.args(&["/c", "mklink", "/D", &target, &path]); 31 | self.cmd = Some(cmd); 32 | } 33 | 34 | #[cfg(target_family = "unix")] 35 | fn cmd(&mut self) { 36 | let mut cmd = Command::new("sh"); 37 | cmd.args(&["-c", &format!("'ln -sf {} {}'", &self.path, &self.target)]); 38 | self.cmd = Some(cmd) 39 | } 40 | 41 | pub async fn create(&mut self) -> anyhow::Result<()> { 42 | self.cmd(); 43 | let cmd = self.cmd.as_mut().unwrap(); 44 | cmd.stdout(Stdio::piped()); 45 | let mut child = cmd.spawn()?; 46 | let stderr = child.stdout.take().unwrap(); 47 | let mut reader = BufReader::new(stderr).lines(); 48 | let succeed = child.wait().await?.success(); 49 | if !succeed { 50 | while let Some(line) = reader.next_line().await? { 51 | println!("Symlink err: {line}"); 52 | } 53 | } 54 | 55 | Ok(()) 56 | } 57 | 58 | pub fn delete(&self) -> anyhow::Result<()> { 59 | std::fs::remove_file(&self.path)?; 60 | Ok(()) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /templates/cfg.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "plugnplay": {}, 3 | "plugins": { 4 | "plugnplay": "gh:nvim-plugnplay/plugnplay.nvim" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /templates/plugin.json: -------------------------------------------------------------------------------- 1 | {} 2 | --------------------------------------------------------------------------------