diff --git a/.gitignore b/.gitignore index c3f592f..80d0377 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ Cargo.lock target *.sublime-workspace +*.sln +*/.vs diff --git a/Cargo.toml b/Cargo.toml index 3120ecb..e56ea34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Fraser Hutchison "] description = "An interactive CLI tool to add a remote fork to a local Git repository." -license = "GPL-3.0" +license = "MIT/Apache-2.0" name = "add-remote" readme = "README.md" version = "0.8.0" diff --git a/MSVC/Add-Remote.sln b/MSVC/Add-Remote.sln new file mode 100644 index 0000000..4c5b052 --- /dev/null +++ b/MSVC/Add-Remote.sln @@ -0,0 +1,20 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}") = "add_remote", "Add-Remote\target\stable\debug\add_remote.exe", "{00000000-0000-0000-0000-000000000000}" + ProjectSection(DebuggerProjectSystem) = preProject + Executable = Add-Remote\target\stable\debug\add_remote.exe + Arguments = + StartingDirectory = Add-Remote\target\stable\debug + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Natvis", "Natvis", "{00000000-0000-0000-0000-000000000000}" + ProjectSection(SolutionItems) = preProject + liballoc.natvis = liballoc.natvis + libcollections.natvis = libcollections.natvis + libcore.natvis = libcore.natvis + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{00000000-0000-0000-0000-000000000000}" + ProjectSection(SolutionItems) = preProject + ..\src\main.rs = ..\src\main.rs + EndProjectSection +EndProject diff --git a/MSVC/liballoc.natvis b/MSVC/liballoc.natvis new file mode 100644 index 0000000..6679e13 --- /dev/null +++ b/MSVC/liballoc.natvis @@ -0,0 +1,55 @@ + + + + {{ size={len} }} + + len + buf.cap + + len + buf.ptr.pointer.__0 + + + + + {{ size={tail <= head ? head - tail : buf.cap - tail + head} }} + + tail <= head ? head - tail : buf.cap - tail + head + buf.cap + + + tail <= head ? head - tail : buf.cap - tail + head + + + + + buf.ptr.pointer.__0 + i + i = (i + 1 == buf.cap ? 0 : i + 1) + + + + + + {{ size={len} }} + + + len + *(alloc::linked_list::Node<$T1> **)&head + *(alloc::linked_list::Node<$T1> **)&next + element + + + + + {*(char**)this,[vec.len]} + *(char**)this,[vec.len] + + vec.len + vec.buf.cap + + vec.len + *(char**)this + + + + diff --git a/MSVC/libcollections.natvis b/MSVC/libcollections.natvis new file mode 100644 index 0000000..7097e89 --- /dev/null +++ b/MSVC/libcollections.natvis @@ -0,0 +1,55 @@ + + + + {{ size={len} }} + + len + buf.cap + + len + buf.ptr.pointer.__0 + + + + + {{ size={tail <= head ? head - tail : buf.cap - tail + head} }} + + tail <= head ? head - tail : buf.cap - tail + head + buf.cap + + + tail <= head ? head - tail : buf.cap - tail + head + + + + + buf.ptr.pointer.__0 + i + i = (i + 1 == buf.cap ? 0 : i + 1) + + + + + + {{ size={len} }} + + + len + *(collections::linked_list::Node<$T1> **)&head + *(collections::linked_list::Node<$T1> **)&next + element + + + + + {*(char**)this,[vec.len]} + *(char**)this,[vec.len] + + vec.len + vec.buf.cap + + vec.len + *(char**)this + + + + diff --git a/MSVC/libcore.natvis b/MSVC/libcore.natvis new file mode 100644 index 0000000..05aa3c5 --- /dev/null +++ b/MSVC/libcore.natvis @@ -0,0 +1,39 @@ + + + + {{ Unique {*pointer.__0} }} + + pointer.__0 + + + + {{ Shared {*pointer.__0} }} + + pointer.__0 + + + + {{ None }} + {{ Some {__0} }} + + (ULONG)(RUST$ENUM$DISR != 0) + __0 + + (ULONG)(RUST$ENUM$DISR != 0) + &__0 + + + + + {{ None }} + {{ Some {($T1 *)this} }} + + (ULONG)(*(PVOID *)this != nullptr) + ($T1 *)this + + (ULONG)(*(PVOID *)this != nullptr) + ($T1 *)this + + + + diff --git a/rustfmt.toml b/rustfmt.toml index dac7789..7ac4422 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,6 +1,13 @@ +array_layout = "Visual" +combine_control_expr = false condense_wildcard_suffices = true +control_style = "Legacy" +fn_args_layout = "Visual" +fn_args_paren_newline = true +fn_call_style = "Visual" fn_call_width = 100 fn_single_line = true +generics_indent = "Visual" ideal_width = 100 newline_style = "Native" reorder_imports = true @@ -9,4 +16,5 @@ single_line_if_else_max_width = 100 struct_lit_width = 100 struct_variant_width = 100 use_try_shorthand = true +where_style = "Legacy" write_mode = "Overwrite" diff --git a/src/repo.rs b/src/repo.rs index 0d34dcc..4015f6f 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -99,7 +99,7 @@ impl Repo { } else { yellow!("Choose fork (enter index number): "); } - #[cfg_attr(feature="cargo-clippy", allow(cast_possible_truncation))] + #[cfg_attr(feature = "cargo-clippy", allow(cast_possible_truncation))] match get_uint(&mut self.stdin.lock(), default) { Err(error) => { red_ln!("{}", error); @@ -177,7 +177,7 @@ impl Repo { /// Process the user's choices, i.e. add the new remote. Also calls `git fetch` for the new /// remote and displays the remotes when complete. - #[cfg_attr(feature="cargo-clippy", allow(use_debug))] + #[cfg_attr(feature = "cargo-clippy", allow(use_debug))] pub fn set_remote(&self) { prnt_ln!(""); let remotes_before = self.git_remote_verbose_output(); @@ -247,9 +247,8 @@ impl Repo { /// not being executed from within a Git repository, so we print an error message to that effect /// exit with a non-zero code. fn populate_local_remotes(&mut self) { - let local_remotes_output = unwrap!(Command::new(&self.git) - .args(&["remote", "show"]) - .output()); + let local_remotes_output = + unwrap!(Command::new(&self.git).args(&["remote", "show"]).output()); // Get list of local remotes. if !local_remotes_output.status.success() { red_ln!("Failed to execute 'git remote show'. Execute this program from inside a Git \ @@ -343,14 +342,16 @@ impl Repo { } // Choose the main fork/source owner if available. if let Ok(index) = self.available_forks - .binary_search_by_key(&self.main_fork_owner.0.to_lowercase(), - |&(ref owner, _)| owner.0.to_lowercase()) { + .binary_search_by_key(&self.main_fork_owner.0.to_lowercase(), |&(ref owner, _)| { + owner.0.to_lowercase() + }) { return Some(index as u64); } // Next look for "maidsafe". if let Ok(index) = self.available_forks - .binary_search_by_key(&"maidsafe".to_string(), - |&(ref owner, _)| owner.0.to_lowercase()) { + .binary_search_by_key(&"maidsafe".to_string(), |&(ref owner, _)| { + owner.0.to_lowercase() + }) { return Some(index as u64); } None @@ -369,9 +370,7 @@ impl Repo { .args(&["config", &alias_arg]) .output()); if output.status.success() { - String::from_utf8_lossy(&output.stdout) - .trim() - .to_string() + String::from_utf8_lossy(&output.stdout).trim().to_string() } else { chosen_owner.0.clone() }