Rust 2018
This commit is contained in:
@@ -6,6 +6,7 @@ repository = "https://github.com/r-darwish/topgrade"
|
||||
version = "1.1.0"
|
||||
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>"]
|
||||
exclude = ["doc/screenshot.gif"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
directories = "1.0.2"
|
||||
@@ -14,14 +15,14 @@ failure_derive = "0.1.3"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
toml = "0.4.10"
|
||||
which = "2.0.1"
|
||||
which_crate = { version = "2.0.1", package = "which" }
|
||||
shellexpand = "1.0.0"
|
||||
structopt = "0.2.14"
|
||||
log = "0.4.6"
|
||||
env_logger = "0.6.0"
|
||||
walkdir = "2.2.7"
|
||||
console = "0.7.1"
|
||||
self_update = { version = "0.5.0", optional = true }
|
||||
self_update_crate = { version = "0.5.0", optional = true, package = "self_update" }
|
||||
lazy_static = "1.2.0"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
@@ -33,4 +34,4 @@ lto = true
|
||||
[features]
|
||||
default = []
|
||||
|
||||
self-update = ["self_update"]
|
||||
self-update = ["self_update_crate"]
|
||||
|
||||
21
src/main.rs
21
src/main.rs
@@ -1,22 +1,3 @@
|
||||
extern crate console;
|
||||
extern crate directories;
|
||||
extern crate env_logger;
|
||||
extern crate failure;
|
||||
extern crate failure_derive;
|
||||
extern crate lazy_static;
|
||||
extern crate log;
|
||||
#[cfg(unix)]
|
||||
extern crate nix;
|
||||
#[cfg(feature = "self-update")]
|
||||
extern crate self_update as self_update_crate;
|
||||
extern crate serde;
|
||||
extern crate serde_derive;
|
||||
extern crate shellexpand;
|
||||
extern crate structopt;
|
||||
extern crate toml;
|
||||
extern crate walkdir;
|
||||
extern crate which;
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
mod freebsd;
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -48,13 +29,13 @@ use self::config::Config;
|
||||
use self::error::{Error, ErrorKind};
|
||||
use self::git::{Git, Repositories};
|
||||
use self::report::Report;
|
||||
use self::terminal::*;
|
||||
use failure::{Fail, ResultExt};
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
use std::io;
|
||||
use std::process::exit;
|
||||
use structopt::StructOpt;
|
||||
use terminal::*;
|
||||
|
||||
fn execute<'a, F, M>(func: F, no_retry: bool) -> Result<Option<(M, bool)>, Error>
|
||||
where
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::error::Error;
|
||||
use super::executor::Executor;
|
||||
use super::terminal::print_separator;
|
||||
use super::utils::{which, Check};
|
||||
use directories::BaseDirs;
|
||||
use Error;
|
||||
|
||||
pub fn run_zplug(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||
if let Some(zsh) = which("zsh") {
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::ffi::OsStr;
|
||||
use std::fmt::Debug;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{ExitStatus, Output};
|
||||
use which as which_mod;
|
||||
use which_crate;
|
||||
|
||||
pub trait Check {
|
||||
fn check(self) -> Result<(), Error>;
|
||||
@@ -49,14 +49,14 @@ impl PathExt for PathBuf {
|
||||
}
|
||||
|
||||
pub fn which<T: AsRef<OsStr> + Debug>(binary_name: T) -> Option<PathBuf> {
|
||||
match which_mod::which(&binary_name) {
|
||||
match which_crate::which(&binary_name) {
|
||||
Ok(path) => {
|
||||
debug!("Detected {:?} as {:?}", &path, &binary_name);
|
||||
Some(path)
|
||||
}
|
||||
Err(e) => {
|
||||
match e.kind() {
|
||||
which_mod::ErrorKind::CannotFindBinaryPath => {
|
||||
which_crate::ErrorKind::CannotFindBinaryPath => {
|
||||
debug!("Cannot find {:?}", &binary_name);
|
||||
}
|
||||
_ => {
|
||||
|
||||
Reference in New Issue
Block a user