├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Justfile ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.adoc └── src ├── bin └── shell.rs ├── errors.rs └── lib.rs /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .cargo 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [root] 2 | name = "cargo-shell" 3 | version = "0.1.0" 4 | dependencies = [ 5 | "cargo 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", 6 | "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 7 | "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 8 | "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 9 | "rustyline 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 10 | ] 11 | 12 | [[package]] 13 | name = "advapi32-sys" 14 | version = "0.2.0" 15 | source = "registry+https://github.com/rust-lang/crates.io-index" 16 | dependencies = [ 17 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 18 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 19 | ] 20 | 21 | [[package]] 22 | name = "aho-corasick" 23 | version = "0.5.3" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | dependencies = [ 26 | "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", 27 | ] 28 | 29 | [[package]] 30 | name = "backtrace" 31 | version = "0.3.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | dependencies = [ 34 | "backtrace-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 35 | "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 36 | "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 37 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 39 | "rustc-demangle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 41 | ] 42 | 43 | [[package]] 44 | name = "backtrace-sys" 45 | version = "0.1.5" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | dependencies = [ 48 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 50 | ] 51 | 52 | [[package]] 53 | name = "bitflags" 54 | version = "0.1.1" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | 57 | [[package]] 58 | name = "bitflags" 59 | version = "0.4.0" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | 62 | [[package]] 63 | name = "bitflags" 64 | version = "0.7.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | 67 | [[package]] 68 | name = "cargo" 69 | version = "0.14.0" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | dependencies = [ 72 | "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 73 | "crates-io 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 74 | "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", 75 | "curl 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 76 | "docopt 0.6.86 (registry+https://github.com/rust-lang/crates.io-index)", 77 | "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 78 | "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 79 | "flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", 80 | "fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 81 | "git2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 82 | "git2-curl 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 83 | "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 84 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 85 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 86 | "libgit2-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 87 | "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 89 | "num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 90 | "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", 91 | "psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 92 | "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", 93 | "rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", 94 | "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 95 | "tar 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 96 | "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 97 | "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 98 | "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "url 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 100 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 101 | ] 102 | 103 | [[package]] 104 | name = "cfg-if" 105 | version = "0.1.0" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | 108 | [[package]] 109 | name = "cmake" 110 | version = "0.1.18" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | dependencies = [ 113 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 114 | ] 115 | 116 | [[package]] 117 | name = "crates-io" 118 | version = "0.4.0" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | dependencies = [ 121 | "curl 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 122 | "rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", 123 | "url 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 124 | ] 125 | 126 | [[package]] 127 | name = "crossbeam" 128 | version = "0.2.10" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | 131 | [[package]] 132 | name = "curl" 133 | version = "0.3.11" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | dependencies = [ 136 | "curl-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 137 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 138 | "openssl-probe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 139 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 140 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 141 | ] 142 | 143 | [[package]] 144 | name = "curl-sys" 145 | version = "0.2.5" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | dependencies = [ 148 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 149 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 150 | "libz-sys 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", 151 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 152 | "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 153 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 154 | ] 155 | 156 | [[package]] 157 | name = "dbghelp-sys" 158 | version = "0.2.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | dependencies = [ 161 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 162 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 163 | ] 164 | 165 | [[package]] 166 | name = "docopt" 167 | version = "0.6.86" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | dependencies = [ 170 | "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 171 | "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", 172 | "rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", 173 | "strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 174 | ] 175 | 176 | [[package]] 177 | name = "encode_unicode" 178 | version = "0.1.3" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | 181 | [[package]] 182 | name = "env_logger" 183 | version = "0.3.5" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | dependencies = [ 186 | "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 187 | "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", 188 | ] 189 | 190 | [[package]] 191 | name = "error-chain" 192 | version = "0.7.1" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | dependencies = [ 195 | "backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 196 | ] 197 | 198 | [[package]] 199 | name = "filetime" 200 | version = "0.1.10" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | dependencies = [ 203 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 204 | ] 205 | 206 | [[package]] 207 | name = "flate2" 208 | version = "0.2.14" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | dependencies = [ 211 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 212 | "miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 213 | ] 214 | 215 | [[package]] 216 | name = "fs2" 217 | version = "0.2.5" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | dependencies = [ 220 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 221 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 222 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 223 | ] 224 | 225 | [[package]] 226 | name = "gcc" 227 | version = "0.3.38" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | 230 | [[package]] 231 | name = "gdi32-sys" 232 | version = "0.2.0" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | dependencies = [ 235 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 236 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 237 | ] 238 | 239 | [[package]] 240 | name = "git2" 241 | version = "0.4.4" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | dependencies = [ 244 | "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 245 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 246 | "libgit2-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 247 | "url 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 248 | ] 249 | 250 | [[package]] 251 | name = "git2-curl" 252 | version = "0.5.0" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | dependencies = [ 255 | "curl 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 256 | "git2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 257 | "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 258 | "url 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 259 | ] 260 | 261 | [[package]] 262 | name = "glob" 263 | version = "0.2.11" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | 266 | [[package]] 267 | name = "idna" 268 | version = "0.1.0" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | dependencies = [ 271 | "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 272 | "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 273 | "unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 274 | ] 275 | 276 | [[package]] 277 | name = "kernel32-sys" 278 | version = "0.2.2" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | dependencies = [ 281 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 283 | ] 284 | 285 | [[package]] 286 | name = "lazy_static" 287 | version = "0.2.2" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | 290 | [[package]] 291 | name = "libc" 292 | version = "0.2.17" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | 295 | [[package]] 296 | name = "libgit2-sys" 297 | version = "0.4.6" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | dependencies = [ 300 | "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", 301 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 302 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 303 | "libssh2-sys 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", 304 | "libz-sys 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", 305 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 306 | "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 307 | ] 308 | 309 | [[package]] 310 | name = "libressl-pnacl-sys" 311 | version = "2.1.6" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | dependencies = [ 314 | "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 315 | ] 316 | 317 | [[package]] 318 | name = "libssh2-sys" 319 | version = "0.1.41" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | dependencies = [ 322 | "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", 323 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 324 | "libz-sys 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", 325 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 326 | "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 327 | ] 328 | 329 | [[package]] 330 | name = "libz-sys" 331 | version = "1.0.7" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | dependencies = [ 334 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 335 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 336 | "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 337 | ] 338 | 339 | [[package]] 340 | name = "log" 341 | version = "0.3.6" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | 344 | [[package]] 345 | name = "matches" 346 | version = "0.1.4" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | 349 | [[package]] 350 | name = "memchr" 351 | version = "0.1.11" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | dependencies = [ 354 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 355 | ] 356 | 357 | [[package]] 358 | name = "miniz-sys" 359 | version = "0.1.7" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | dependencies = [ 362 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 363 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 364 | ] 365 | 366 | [[package]] 367 | name = "miow" 368 | version = "0.1.3" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | dependencies = [ 371 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 372 | "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", 373 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 374 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 375 | ] 376 | 377 | [[package]] 378 | name = "net2" 379 | version = "0.2.26" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | dependencies = [ 382 | "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 383 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 384 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 385 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 386 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 387 | ] 388 | 389 | [[package]] 390 | name = "nix" 391 | version = "0.5.1" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | dependencies = [ 394 | "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 395 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 396 | ] 397 | 398 | [[package]] 399 | name = "num_cpus" 400 | version = "1.1.0" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | dependencies = [ 403 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 404 | ] 405 | 406 | [[package]] 407 | name = "openssl" 408 | version = "0.7.14" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | dependencies = [ 411 | "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 412 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 413 | "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 414 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 415 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 416 | "openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", 417 | ] 418 | 419 | [[package]] 420 | name = "openssl-probe" 421 | version = "0.1.0" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | 424 | [[package]] 425 | name = "openssl-sys" 426 | version = "0.7.17" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | dependencies = [ 429 | "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 430 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 431 | "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 432 | "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 433 | "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 434 | ] 435 | 436 | [[package]] 437 | name = "openssl-sys-extras" 438 | version = "0.7.14" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | dependencies = [ 441 | "gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", 442 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 443 | "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", 444 | ] 445 | 446 | [[package]] 447 | name = "pkg-config" 448 | version = "0.3.8" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | 451 | [[package]] 452 | name = "pnacl-build-helper" 453 | version = "1.4.10" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | dependencies = [ 456 | "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 457 | ] 458 | 459 | [[package]] 460 | name = "psapi-sys" 461 | version = "0.1.0" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | dependencies = [ 464 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 465 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 466 | ] 467 | 468 | [[package]] 469 | name = "rand" 470 | version = "0.3.14" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | dependencies = [ 473 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 474 | ] 475 | 476 | [[package]] 477 | name = "regex" 478 | version = "0.1.80" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | dependencies = [ 481 | "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 482 | "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", 483 | "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 484 | "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 485 | "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 486 | ] 487 | 488 | [[package]] 489 | name = "regex-syntax" 490 | version = "0.3.9" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | 493 | [[package]] 494 | name = "rustc-demangle" 495 | version = "0.1.3" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | 498 | [[package]] 499 | name = "rustc-serialize" 500 | version = "0.3.21" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | 503 | [[package]] 504 | name = "rustyline" 505 | version = "1.0.0" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | dependencies = [ 508 | "encode_unicode 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 509 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 510 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 511 | "nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 512 | "unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 513 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 514 | ] 515 | 516 | [[package]] 517 | name = "semver" 518 | version = "0.5.1" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | dependencies = [ 521 | "semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 522 | ] 523 | 524 | [[package]] 525 | name = "semver-parser" 526 | version = "0.6.1" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | dependencies = [ 529 | "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 530 | "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", 531 | ] 532 | 533 | [[package]] 534 | name = "strsim" 535 | version = "0.5.2" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | 538 | [[package]] 539 | name = "tar" 540 | version = "0.4.8" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | dependencies = [ 543 | "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 544 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 545 | ] 546 | 547 | [[package]] 548 | name = "tempdir" 549 | version = "0.3.5" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | dependencies = [ 552 | "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 553 | ] 554 | 555 | [[package]] 556 | name = "term" 557 | version = "0.4.4" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | dependencies = [ 560 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 561 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 562 | ] 563 | 564 | [[package]] 565 | name = "thread-id" 566 | version = "2.0.0" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | dependencies = [ 569 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 570 | "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", 571 | ] 572 | 573 | [[package]] 574 | name = "thread_local" 575 | version = "0.2.7" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | dependencies = [ 578 | "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 579 | ] 580 | 581 | [[package]] 582 | name = "toml" 583 | version = "0.2.1" 584 | source = "registry+https://github.com/rust-lang/crates.io-index" 585 | dependencies = [ 586 | "rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", 587 | ] 588 | 589 | [[package]] 590 | name = "unicode-bidi" 591 | version = "0.2.3" 592 | source = "registry+https://github.com/rust-lang/crates.io-index" 593 | dependencies = [ 594 | "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 595 | ] 596 | 597 | [[package]] 598 | name = "unicode-normalization" 599 | version = "0.1.2" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | 602 | [[package]] 603 | name = "unicode-width" 604 | version = "0.1.3" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | 607 | [[package]] 608 | name = "url" 609 | version = "1.2.3" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | dependencies = [ 612 | "idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 613 | "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 614 | ] 615 | 616 | [[package]] 617 | name = "user32-sys" 618 | version = "0.2.0" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | dependencies = [ 621 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 622 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 623 | ] 624 | 625 | [[package]] 626 | name = "utf8-ranges" 627 | version = "0.1.3" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | 630 | [[package]] 631 | name = "winapi" 632 | version = "0.2.8" 633 | source = "registry+https://github.com/rust-lang/crates.io-index" 634 | 635 | [[package]] 636 | name = "winapi-build" 637 | version = "0.1.1" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | 640 | [[package]] 641 | name = "ws2_32-sys" 642 | version = "0.2.1" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | dependencies = [ 645 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 646 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 647 | ] 648 | 649 | [metadata] 650 | "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" 651 | "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" 652 | "checksum backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f551bc2ddd53aea015d453ef0b635af89444afa5ed2405dd0b2062ad5d600d80" 653 | "checksum backtrace-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3602e8d8c43336088a8505fa55cae2b3884a9be29440863a11528a42f46f6bb7" 654 | "checksum bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a6577517ecd0ee0934f48a7295a89aaef3e6dfafeac404f94c0b3448518ddfe" 655 | "checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" 656 | "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" 657 | "checksum cargo 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7630f643f1c8de164eb78db782cd0d313f77e36373349dfdb110ee583aa3015" 658 | "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" 659 | "checksum cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0e5bcf27e097a184c1df4437654ed98df3d7a516e8508a6ba45d8b092bbdf283" 660 | "checksum crates-io 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e945be5e805781ccbc1134c481b4535ffefbfab9d2073c2121fb2e1cee52664e" 661 | "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" 662 | "checksum curl 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "45237c5df96ebe61e3fdf152b1b753c958971352705bcae0fc890888fd11681e" 663 | "checksum curl-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d23edf1686d8245e3d23af32774385eb0281b2b5288da9076c191b00be3c9435" 664 | "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" 665 | "checksum docopt 0.6.86 (registry+https://github.com/rust-lang/crates.io-index)" = "4a7ef30445607f6fc8720f0a0a2c7442284b629cf0d049286860fae23e71c4d9" 666 | "checksum encode_unicode 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "28d65f1f5841ef7c6792861294b72beda34c664deb8be27970f36c306b7da1ce" 667 | "checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" 668 | "checksum error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cd681735364a04cd5d69f01a4f6768e70473941f8d86d8c224faf6955a75799" 669 | "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" 670 | "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" 671 | "checksum fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bcd414e5a1a979b931bb92f41b7a54106d3f6d2e6c253e9ce943b7cd468251ef" 672 | "checksum gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "553f11439bdefe755bf366b264820f1da70f3aaf3924e594b886beb9c831bcf5" 673 | "checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" 674 | "checksum git2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "33a96eeef227403006cdb59ea6e05baad8cddde6b79abed753d96ccee136bad2" 675 | "checksum git2-curl 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d5f766d804e3cf2b90e16ab77c3ddedcb1ca5d2456cadb7b3f907345f8c3498" 676 | "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" 677 | "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" 678 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 679 | "checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" 680 | "checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8" 681 | "checksum libgit2-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f8d1217daf6e0812f78c3b81b987b94edc000e8f700aee456c6e7940f818b3e" 682 | "checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71" 683 | "checksum libssh2-sys 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "1c1f9e300f7fe8326cdc081ba0c7b64a0386380498598ad5d1ea34cc0b7e7434" 684 | "checksum libz-sys 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "283c2d162f78c5090522e13fc809820c33181570ae40de1bea84f3864c8759f9" 685 | "checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" 686 | "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" 687 | "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" 688 | "checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" 689 | "checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a" 690 | "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" 691 | "checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" 692 | "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" 693 | "checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733" 694 | "checksum openssl-probe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "756d49c8424483a3df3b5d735112b4da22109ced9a8294f1f5cdf80fb3810919" 695 | "checksum openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f" 696 | "checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa" 697 | "checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" 698 | "checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b" 699 | "checksum psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "abcd5d1a07d360e29727f757a9decb3ce8bc6e0efa8969cfaad669a8317a2478" 700 | "checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" 701 | "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" 702 | "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" 703 | "checksum rustc-demangle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1430d286cadb237c17c885e25447c982c97113926bb579f4379c0eca8d9586dc" 704 | "checksum rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)" = "bff9fc1c79f2dec76b253273d07682e94a978bd8f132ded071188122b2af9818" 705 | "checksum rustyline 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00b06ac9c8e8e3e83b33d175d39a9f7b6c2c930c82990593719c8e48788ae2d9" 706 | "checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" 707 | "checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" 708 | "checksum strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "67f84c44fbb2f91db7fef94554e6b2ac05909c9c0b0bc23bb98d3a1aebfe7f7c" 709 | "checksum tar 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "12e1b959f637c2e4c69dbdbf4d7dc609edbaada9b8c35d0c2fc9802d02383b65" 710 | "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" 711 | "checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" 712 | "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" 713 | "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" 714 | "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" 715 | "checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f" 716 | "checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172" 717 | "checksum unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6722facc10989f63ee0e20a83cd4e1714a9ae11529403ac7e0afd069abc39e" 718 | "checksum url 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "48ccf7bd87a81b769cf84ad556e034541fb90e1cd6d4bc375c822ed9500cd9d7" 719 | "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" 720 | "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" 721 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 722 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 723 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 724 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | authors = ["Paul Woolcock "] 3 | description = "Simple command shell for cargo\n" 4 | homepage = "https://github.com/pwoolcoc/cargo-shell" 5 | license = "MIT/Apache-2.0" 6 | name = "cargo-shell" 7 | repository = "https://github.com/pwoolcoc/cargo-shell" 8 | version = "0.1.1" 9 | 10 | [[bin]] 11 | name = "cargo-shell" 12 | path = "src/bin/shell.rs" 13 | 14 | [dependencies] 15 | cargo = "0.14.0" 16 | env_logger = "0.3.5" 17 | error-chain = "0.7.1" 18 | log = "0.3.6" 19 | rustyline = "1.0.0" 20 | 21 | [lib] 22 | name = "shell" 23 | path = "src/lib.rs" 24 | -------------------------------------------------------------------------------- /Justfile: -------------------------------------------------------------------------------- 1 | doc: 2 | cargo doc 3 | mkdir -p target/doc 4 | asciidoctor -o target/doc/README.html README.adoc 5 | 6 | serve: doc 7 | (cd target/doc && python3 -m http.server) 8 | 9 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 The Rust Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = cargo-shell 2 | :toc: 3 | 4 | == Introduction 5 | 6 | `cargo shell` is a command shell for `cargo`, inspired by `sbt`. It incorporates a number of existing tools, along with some additional features, to make 7 | developing rust applications a little nicer. 8 | 9 | == Installation 10 | 11 | `cargo-shell` makes liberal use of the tools you probably already have installed, so it expects that you have a working `rust` installation (obviously) as 12 | well as `rustup.rs`. 13 | 14 | ---- 15 | $ cargo install cargo-shell 16 | ---- 17 | 18 | == Usage 19 | 20 | After installation, the shell can be started by running `cargo shell` on the command line: 21 | 22 | ---- 23 | $ cargo shell 24 | Welcome to cargo-shell v0.1.0 25 | >> build 26 | >> test 27 | >> bench 28 | ---- 29 | 30 | ...etc 31 | 32 | == Is that...it? 33 | 34 | At this point, we don't really have a lot of advantages over just aliasing `cargo` to `c` and running `c build`, etc. However, `cargo-shell` comes with a few built-in 35 | features that make it more useful. 36 | 37 | === `cargo-watch` integration 38 | 39 | If you have `cargo-watch` installed on your system, you can cause any command to be re-run when the source files change. This is done by prepending a `~` to the command: 40 | 41 | ---- 42 | $ cargo shell 43 | Welcome to cargo-shell v0.1.0 44 | >> ~run 45 | Hello, World! 46 | Waiting for changes... Hit Ctrl-C to stop. 47 | ---- 48 | 49 | === Running a command using a different toolchain 50 | 51 | `rustup` is great for letting us run commands using different versions of rust. The command to do this, however, can get a bit verbose. Sure, aliases can help. But 52 | with the command shell, running a command with a different toolchain is simple: 53 | 54 | Let's say you are using the `stable` toolchain, but want to test using nightly: 55 | 56 | ---- 57 | $ cargo shell 58 | Welcome to cargo-shell v0.1.0 59 | >> build 60 | # builds using `stable` 61 | >> ++nightly test 62 | # tests using `nightly` 63 | ---- 64 | 65 | After the `cargo test` command is done running, the shell will go back to using the `stable` toolchain again. To permanently change it in the shell, just leave the command 66 | off the end: 67 | 68 | ---- 69 | $ cargo shell 70 | Welcome to cargo-shell v0.1.0 71 | >> ++nightly 72 | >> do build, test 73 | # shell remains in nightly until you change it back manually 74 | ---- 75 | 76 | === Running a command under multiple toolchains 77 | 78 | Let's say we want to run the tests for a project under `stable`, `beta`, and `nightly` (which are the default, though this is configurable): 79 | 80 | ---- 81 | $ cargo shell 82 | Welcome to cargo-shell v0.1.0 83 | >> +test 84 | ---- 85 | 86 | ...and that's it! There is a config option, `cargo-shell.toolchains` that will let you customize the list of toolchains that this runs. 87 | 88 | === Running a list of commands from a file 89 | 90 | The `<` operator will let you run a series of commands from a file. For example, this file: 91 | 92 | .test-file 93 | ---- 94 | build 95 | test 96 | bench 97 | ---- 98 | 99 | Can be run like this: 100 | 101 | ---- 102 | $ cargo shell 103 | Welcome to cargo-shell v0.1.0 104 | >> < test-file 105 | ---- 106 | 107 | and the `build`, `test` and `bench` commands will be run in sequence 108 | 109 | 110 | === Changing the prompt mid-session 111 | 112 | The prompt can be changed permanently in your config, but if you want to change it mid-session, you can use the `p` command: 113 | 114 | ---- 115 | $ cargo shell 116 | Welcome to cargo-shell v0.1.0 117 | >> p $ 118 | $ 119 | ---- 120 | 121 | One limitation is that leading & trailing whitespace is trimmed, so if you want a space at the end of your prompt, use quotes: 122 | 123 | ---- 124 | $ cargo shell 125 | Welcome to cargo-shell v0.1.0 126 | >> p "$ " 127 | $ # now there is a space here 128 | ---- 129 | 130 | == Configuration 131 | 132 | There are a few configuration options available to customize `cargo-shell`. You put them in a `.cargo/config` file under the `[cargo-shell]` 133 | heading. 134 | 135 | === Prompt 136 | 137 | This will customize the look of the shell prompt. There are a few placeholders that you can use: `{project}`, `{version}` and `{toolchain}`. 138 | After every command, `cargo-shell` will replace them with the project name, project version, and current toolchain, respectively. 139 | 140 | For example, to end up with a prompt like `"my-project stable>> "`, you would set the prompt to this: 141 | 142 | ---- 143 | [cargo-shell] 144 | prompt = "{project} {toolchain}>> " 145 | ---- 146 | 147 | By default it is just: 148 | 149 | ---- 150 | [cargo-shell] 151 | prompt = ">> " 152 | ---- 153 | 154 | === Default toolchain 155 | 156 | This is the toolchain that the shell will start using by default. 157 | 158 | NOTE: This will be going away as soon as I get better integration with rustup's overrides in place. At that point, 159 | `cargo-shell` will use the same default toolchain as `rustup`, and will respect any overrides that you have put in 160 | place using `rustup`. 161 | 162 | ---- 163 | [cargo-shell] 164 | default_toolchain = "stable" 165 | ---- 166 | 167 | === Toolchain list 168 | 169 | This will customize the toolchains that a command is run under when using the `+` shell command. 170 | 171 | ---- 172 | [cargo-shell] 173 | toolchains = ["stable", "beta", "nightly"] 174 | ---- 175 | 176 | == TODO 177 | 178 | - [x] Documentation 179 | - [ ] Detect toolchain default & overrides from rustup 180 | - [ ] Shell history 181 | - [ ] git integration for the prompt 182 | - [ ] autocomplete 183 | -------------------------------------------------------------------------------- /src/bin/shell.rs: -------------------------------------------------------------------------------- 1 | extern crate shell; 2 | extern crate env_logger; 3 | #[macro_use] extern crate error_chain; 4 | 5 | use std::io::{self, Write}; 6 | use std::process; 7 | use std::error::Error as StdError; 8 | 9 | fn main() { 10 | env_logger::init().unwrap(); 11 | if let Err(e) = shell::main() { 12 | let _ = writeln!(&mut io::stderr(), "{}", e.description()); 13 | process::exit(1); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/errors.rs: -------------------------------------------------------------------------------- 1 | error_chain!{ } 2 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate rustyline; 2 | extern crate cargo; 3 | #[macro_use] extern crate error_chain; 4 | #[macro_use] extern crate log; 5 | 6 | mod errors; 7 | 8 | use std::fs::File; 9 | use std::io::{stderr, Write, BufReader, BufRead}; 10 | use std::process::{Command, Stdio}; 11 | use std::path::{Path, PathBuf}; 12 | use std::env; 13 | 14 | use rustyline::Editor; 15 | use rustyline::error::ReadlineError; 16 | use cargo::core::Package; 17 | use cargo::util::Config as CargoConfig; 18 | use cargo::util::important_paths::{find_root_manifest_for_wd}; 19 | 20 | use errors::*; 21 | 22 | const USAGE: &'static str = r#"Cargo Command Shell 23 | ------------------- 24 | 25 | Any command that you would normally type after `cargo ` is a valid command here, and should 26 | bring about the same result that running `cargo COMMAND` would from your regular command shell. 27 | 28 | Special commands: 29 | 30 | * `+ ` 31 | runs the command under multiple toolchains, which are defined using the `cargo-shell.toolchains` 32 | configuration option 33 | * `++ []` 34 | This runs a command under a specific toolchain. If the `` is left off, then the active 35 | toolchain for the shell is changed. 36 | * `< ` 37 | This runs commands from the file named by ``. It looks for a command on each line, and 38 | lines that are empty or that start with `#` are ignored. 39 | * `~ ` 40 | This command is only available if `cargo-watch` is available. It will run the `` using 41 | `cargo-watch`, which causes the command to be re-run whenever a source file changes. 42 | 43 | "#; 44 | 45 | // TODO: this should come from rustup instead of being specified here 46 | const DEFAULT_TOOLCHAIN: &'static str = "stable"; 47 | 48 | struct Config { 49 | pub prompt: String, 50 | pub rustup: PathBuf, 51 | pub name: String, 52 | pub version: String, 53 | pub default_toolchain: String, 54 | pub toolchains: Vec, 55 | pub current_toolchain: String, 56 | pub cwd: PathBuf, 57 | } 58 | 59 | impl Config { 60 | fn prompt(cconfig: &CargoConfig) -> Result { 61 | let prompt= cconfig.get_string("cargo-shell.prompt").chain_err(|| "Could not find cargo-shell.prompt")?; 62 | let prompt = match prompt { 63 | Some(prompt) => prompt.val, 64 | None => ">> ".to_string() 65 | }; 66 | 67 | Ok(prompt) 68 | } 69 | 70 | fn get_prompt(&self) -> String { 71 | let prompt = self.prompt.replace("{project}", &self.name) 72 | .replace("{version}", &self.version) 73 | .replace("{toolchain}", &self.current_toolchain); 74 | 75 | prompt 76 | } 77 | 78 | fn default_toolchain(cconfig: &CargoConfig) -> Result { 79 | let def = cconfig.get_string("cargo-shell.default-toolchain").chain_err(|| "Could not find cargo-shell.default-toolchain")?; 80 | let def = match def { 81 | Some(d) => d.val, 82 | None => DEFAULT_TOOLCHAIN.into(), 83 | }; 84 | Ok(def) 85 | } 86 | 87 | fn get_name_and_version(cconfig: &CargoConfig) -> Result<(String, String)> { 88 | let manifest = find_root_manifest_for_wd(None, cconfig.cwd()).chain_err(|| "Could not find root manifest for project")?; 89 | let pkg = Package::for_path(&manifest, cconfig).chain_err(|| "Could not get package path for current crate")?; 90 | Ok((pkg.name().into(), pkg.version().to_string())) 91 | } 92 | 93 | fn get_toolchains(cconfig: &CargoConfig) -> Result> { 94 | let toolchains = cconfig.get_list("cargo-shell.toolchains").chain_err(|| "Could not get cargo-shell.toolchains value")?; 95 | let toolchains = match toolchains { 96 | Some(toolchains) => toolchains.val.into_iter().map(|(s, _p)| s).collect::>(), 97 | None => vec!["stable".into(), "beta".into(), "nightly".into()], 98 | }; 99 | Ok(toolchains) 100 | } 101 | 102 | fn find_rustup() -> Result { 103 | let cargo_home = env::var("CARGO_HOME").chain_err(|| "CARGO_HOME environment variable not set")?; 104 | let rustup = Path::new(&cargo_home).join("bin").join("rustup"); 105 | if rustup.exists() { 106 | return Ok(rustup.into()); 107 | } else { 108 | // I'll need a solution for windows here, too 109 | let path = env::var("PATH").chain_err(|| "PATH environment variable not set")?; 110 | let paths = path.split(':'); 111 | for p in paths { 112 | let rustup = Path::new(p).join("rustup"); 113 | if rustup.exists() { 114 | return Ok(rustup.into()); 115 | } 116 | } 117 | } 118 | bail!("Could not find a rustup binary"); 119 | } 120 | 121 | fn new() -> Result { 122 | let cconfig = CargoConfig::default().chain_err(|| "Could not get default CargoConfig")?; 123 | let (name, version) = Config::get_name_and_version(&cconfig)?; 124 | let prompt = Config::prompt(&cconfig)?; 125 | 126 | let rustup = Config::find_rustup().chain_err(|| "Could not find a `rustup` binary")?; 127 | debug!("rustup binary found at {:?}", rustup.to_string_lossy()); 128 | 129 | let default_toolchain = Config::default_toolchain(&cconfig)?; 130 | 131 | let toolchains = Config::get_toolchains(&cconfig)?; 132 | 133 | Ok(Config { 134 | prompt: prompt, 135 | rustup: rustup.into(), 136 | name: name, 137 | version: version, 138 | default_toolchain: default_toolchain.clone(), 139 | toolchains: toolchains, 140 | current_toolchain: default_toolchain.clone(), 141 | cwd: cconfig.cwd().into(), 142 | }) 143 | } 144 | } 145 | 146 | pub fn main() -> Result<()> { 147 | let v = env!("CARGO_PKG_VERSION"); 148 | println!("Welcome to cargo-shell v{}", v); 149 | let mut rl = Editor::<()>::new(); 150 | let mut config = Config::new()?; 151 | 152 | loop { 153 | let line = rl.readline(&config.get_prompt()); 154 | match line { 155 | Ok(line) => { 156 | if let Err(e) = dispatch_cmd(&mut config, &line.trim()) { 157 | println!("Error: {:?}", e); 158 | }; 159 | }, 160 | Err(ReadlineError::Eof) => break, 161 | Err(ReadlineError::Interrupted) => continue, 162 | Err(e) => println!("No Input: {:?}", e), 163 | } 164 | } 165 | 166 | Ok(()) 167 | } 168 | 169 | fn dispatch_cmd(config: &mut Config, cmd: &str) -> Result<()> { 170 | if cmd == "exit" || cmd == "quit" { 171 | ::std::process::exit(0); 172 | } else if cmd == "help" { 173 | print_help(); 174 | } else if cmd.starts_with("p ") { 175 | let p = cmd[2..].trim_matches(|c| c == '"' || c == '\'' ).to_string(); 176 | config.prompt = p; 177 | } else if cmd.starts_with("~") { 178 | // ~command 179 | // run every time a source file changes 180 | // only available if cargo-watch is installed 181 | let has_cargo_watch = match Command::new("cargo") 182 | .arg("watch") 183 | .arg("--help") 184 | .stdout(Stdio::null()) 185 | .stdin(Stdio::null()) 186 | .stderr(Stdio::null()) 187 | .status() { 188 | Ok(status) => status.success(), 189 | _ => false, 190 | }; 191 | if !has_cargo_watch { 192 | let stderr = stderr(); 193 | let _ = writeln!(stderr.lock(), 194 | "Could not find cargo-watch, you might need to install it?"); 195 | } else { 196 | let mut new_cmd = vec!["watch"]; 197 | new_cmd.extend_from_slice(&cmd[1..].trim().split(' ').collect::>()); 198 | run(config, &new_cmd)?; 199 | } 200 | } else if cmd.starts_with("<") { 201 | // < filename 202 | // run commands from file `filename` 203 | let file = &cmd[1..].trim(); 204 | let file = File::open(file).chain_err(|| format!("Could not open filename {}", file))?; 205 | let file = BufReader::new(file); 206 | for line in file.lines() { 207 | let line = line.chain_err(|| "Could not get next line from file")?; 208 | let line = line.trim(); 209 | if line == "" || line.starts_with("#") { 210 | continue; 211 | } 212 | let line = line.split(' ').collect::>(); 213 | println!("want to run {:?}?", line); 214 | //run(config, &line)?; 215 | } 216 | } else if cmd.starts_with("++") { 217 | // ++ 218 | // temporarily change the version of rust used to run commands 219 | let parts = cmd[2..].trim().split(' ').collect::>(); 220 | let version = parts[0].trim(); 221 | let original = config.current_toolchain.clone(); 222 | config.current_toolchain = version.into(); 223 | // the command is actually optional, and will cause the toolchain switch to be temporary 224 | if parts.len() > 1 { 225 | let _ = run(config, &parts[1..])?; 226 | config.current_toolchain = original; 227 | } 228 | } else if cmd.starts_with("+") { 229 | // + 230 | // run the command across all rust versions specified in the 231 | // `toolchains` setting list 232 | let original = config.current_toolchain.clone(); 233 | let args = cmd[1..].trim().split(' ').collect::>(); 234 | let toolchains = config.toolchains.clone(); 235 | for toolchain in toolchains { 236 | config.current_toolchain = toolchain; 237 | println!("Running command with toolchain `{}`", config.current_toolchain); 238 | run(config, &args)?; 239 | } 240 | config.current_toolchain = original; 241 | } else { 242 | let args = cmd.split(' ').collect::>(); 243 | run(config, &args)?; 244 | } 245 | Ok(()) 246 | } 247 | 248 | fn print_help() { 249 | println!("{}", USAGE); 250 | } 251 | 252 | fn run(config: &Config, cmd: &[&str]) -> Result<()> { 253 | debug!("{} run {} cargo {}", 254 | &config.rustup.to_string_lossy(), 255 | &config.default_toolchain, 256 | cmd.join(" ")); 257 | let _ = Command::new(&config.rustup) 258 | .arg("run") 259 | .arg(&config.default_toolchain) 260 | .arg("cargo") 261 | .args(cmd) 262 | .current_dir(&config.cwd) 263 | .status() 264 | .chain_err(|| "Could not execute rustup run command")?; 265 | Ok(()) 266 | } 267 | --------------------------------------------------------------------------------