You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// External Crate Importsexterncrate clap;externcrate diesel;// Distro enum importusesuper::distro::{Distro, which_distro};// Imports needed to run each commanduse std::process::Command;// Std Lib Importsuse std::process::exit;use std::collections::HashSet;use db;// Gets what distro is being used from distro.rs// then sets that as a function.pubfn getWhichDistro(){let opt_dist = which_distro();if opt_dist.is_none(){println!("Your distribution is not supported");exit(0);}/// Installs packages for what ever Distro is returned/// from which_distro();////// #Examples////// ```/// let mut packages: HashSet<&str> = HashSet::new();/// packages.push("sudo");/// packages.push("postgresql");/// void_install(packages);/// ```///pubfnopt_distro_install(packages:HashSet<String>){let opt_distro_packages = convert_to_opt_distro(packages);if !opt_distro_packages.is_empty(){pac(opt_distro_packages);}}/// Convert package names from other distros to voidfnconvert_to_opt_distro(input_packages:HashSet<String>) -> HashSet<String>{let results = db::pack_query(input_packages);letmut pac_converted:HashSet<String> = HashSet::new();// Using the querys store into the HashSet the actual// void package name for use laterfor i in results {// All querys will either be a string or '' in the db// allowing us to use is_empty()if !i.opt_distro.is_empty(){
pac_converted.insert(i.opt_distro);}}
pac_converted
}// Figures out the current package manager based on DistropubfnsetFunctionVaribles(){ifopt_distro().contains("Ubuntu"){let opt_pac_install = "apt-get";let opt_pac_install_args = "install";let opt_pac_refresh = "apt-get";let opt_pac_refresh_args = "update";let opt_pac_upgrade = "apt-get";let opt_pac_upgrade_args = "upgrade";}elseifopt_distro().contains("Void"){let opt_pac_install = "xbps-install";let opt_pac_install_args = "-S";let opt_pac_refresh = "xbps-install";let opt_pac_refresh_args = "-Sy";let opt_pac_upgrade = "xbps-install";let opt_pac_upgrade_args = "-Syu";}elseifopt_distro().contains("Debian"){let opt_pac_install = "apt-get";let opt_pac_install_args = "install";let opt_pac_refresh = "apt-get";let opt_pac_refresh_args = "update";let opt_pac_upgrade = "apt-get";let opt_pac_upgrade_args = "upgrade";}elseifopt_distro().contains("Mint"){let opt_pac_install = "apt-get";let opt_pac_install_args = "install";let opt_pac_refresh = "apt-get";let opt_pac_refresh_args = "update";let opt_pac_upgrade = "apt-get";let opt_pac_upgrade_args = "upgrade";}elseifopt_distro().contains("FreeBSD"){let opt_pac_install = "pkg";let opt_pac_install_args = "install";let opt_pac_refresh = "pkg";let opt_pac_refresh_args = "update";let opt_pac_upgrade = "pkg";let opt_pac_upgrade_args = "upgrade";}}// Package Manager specific functions/// Calls the package manager program to install packages////// #Examples////// ```/// let mut packages: HashSet<String> = HashSet::new();/// packages.push("sudo".to_owned());/// pac(packages);/// ```///pubfnpac(mutpackages:HashSet<String>){letmut child = matchCommand::new(opt_pac_install).arg(opt_pac_install_args).args(packages.drain().collect::<Vec<String>>().as_slice()).spawn(){Ok(child) => child,Err(e) => panic!("Failed to execute child: {}", e),};let _unused = child.wait();}/// Calls the xbps-install program to refresh the package list////// #Examples////// ```/// refresh_list();/// ```///pubfnrefresh_list(){letmut child = matchCommand::new(opt_pac_refresh).arg(opt_pac_refresh_args).spawn(){Ok(child) => child,Err(e) => panic!("Failed to execute child: {}", e),};let _unused = child.wait();}/// Calls the xbps-install program to upgrage all packages////// #Examples////// ```/// refresh_list();/// ```///pubfnupgrade_packages(){letmut child = matchCommand::new(opt_pac_upgrade).arg(opt_pac_upgrade_args).spawn(){Ok(child) => child,Err(e) => panic!("Failed to execute child: {}", e),};let _unused = child.wait();}
I expected it to tell me whats wrong with the code.
Instead it crashed with a un-closed delimiter error.
I ran this code:
I expected it to tell me whats wrong with the code.
Instead it crashed with a un-closed delimiter error.
Meta
rustc --version --verbose
Backtrace:
The text was updated successfully, but these errors were encountered: