From 580bead0f06c9ec24239e1d5a2c824606e14b590 Mon Sep 17 00:00:00 2001 From: "A. Nackov" Date: Wed, 10 Apr 2019 20:17:47 +0300 Subject: [PATCH] Add assembly detection and ascii image --- resources/assembly.ascii | 13 +++++++++++++ src/main.rs | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 resources/assembly.ascii diff --git a/resources/assembly.ascii b/resources/assembly.ascii new file mode 100644 index 000000000..ffd1dfcd1 --- /dev/null +++ b/resources/assembly.ascii @@ -0,0 +1,13 @@ +{0} ____ +{0} ,' , `. +{0} ,-+-,.' _ | +{0} .--.--. ,-+-. ; , || +{0} ,--.--. / / ' ,--.'|' | || +{0} / \ | : /`./ | | ,', | |, +{0} .--. .-. | | : ;_ | | / | |--' +{0} \__\/: . . \ \ `.| : | | , +{0} ," .--.; | `----. \ : | |/ +{0} / / ,. | / /`--' / | |`-' +{0}; : .' \'--'. /| ;/ +{0}| , .-./ `--'---' '---' +{0} `--`---' diff --git a/src/main.rs b/src/main.rs index 2a1a372a5..3afc2b47b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -220,6 +220,7 @@ fn true_len(line: &str) -> usize { #[derive(PartialEq, Eq, Hash, Clone)] enum Language { + Assembly, C, Clojure, Cpp, @@ -243,6 +244,7 @@ enum Language { impl fmt::Display for Language { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { + Language::Assembly => write!(f, "Assembly"), Language::C => write!(f, "C"), Language::Clojure => write!(f, "Clojure"), Language::Cpp => write!(f, "C++"), @@ -530,6 +532,7 @@ fn get_total_loc(languages: &tokei::Languages) -> usize { impl From for Language { fn from(language: tokei::LanguageType) -> Self { match language { + tokei::LanguageType::Assembly => Language::Assembly, tokei::LanguageType::C => Language::C, tokei::LanguageType::Clojure => Language::Clojure, tokei::LanguageType::Cpp => Language::Cpp, @@ -555,6 +558,7 @@ impl From for Language { fn get_all_language_types() -> Vec { vec![ + tokei::LanguageType::Assembly, tokei::LanguageType::C, tokei::LanguageType::Clojure, tokei::LanguageType::Cpp, @@ -579,6 +583,7 @@ fn get_all_language_types() -> Vec { impl Info { pub fn get_ascii(&self) -> &str { match self.dominant_language { + Language::Assembly => include_str!("../resources/assembly.ascii"), Language::C => include_str!("../resources/c.ascii"), Language::Clojure => include_str!("../resources/clojure.ascii"), Language::Cpp => include_str!("../resources/cpp.ascii"), @@ -603,6 +608,7 @@ impl Info { fn colors(&self) -> Vec { match self.dominant_language { + Language::Assembly => vec![Color::Cyan], Language::C => vec![Color::BrightBlue, Color::Blue], Language::Clojure => vec![Color::BrightBlue, Color::BrightGreen], Language::Cpp => vec![Color::Yellow, Color::Cyan],