Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assembly detection and ascii image #30

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions resources/assembly.ascii
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{0} ____
{0} ,' , `.
{0} ,-+-,.' _ |
{0} .--.--. ,-+-. ; , ||
{0} ,--.--. / / ' ,--.'|' | ||
{0} / \ | : /`./ | | ,', | |,
{0} .--. .-. | | : ;_ | | / | |--'
{0} \__\/: . . \ \ `.| : | | ,
{0} ," .--.; | `----. \ : | |/
{0} / / ,. | / /`--' / | |`-'
{0}; : .' \'--'. /| ;/
{0}| , .-./ `--'---' '---'
{0} `--`---'
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ fn true_len(line: &str) -> usize {

#[derive(PartialEq, Eq, Hash, Clone)]
enum Language {
Assembly,
C,
Clojure,
Cpp,
Expand All @@ -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++"),
Expand Down Expand Up @@ -530,6 +532,7 @@ fn get_total_loc(languages: &tokei::Languages) -> usize {
impl From<tokei::LanguageType> 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,
Expand All @@ -555,6 +558,7 @@ impl From<tokei::LanguageType> for Language {

fn get_all_language_types() -> Vec<tokei::LanguageType> {
vec![
tokei::LanguageType::Assembly,
tokei::LanguageType::C,
tokei::LanguageType::Clojure,
tokei::LanguageType::Cpp,
Expand All @@ -579,6 +583,7 @@ fn get_all_language_types() -> Vec<tokei::LanguageType> {
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"),
Expand All @@ -603,6 +608,7 @@ impl Info {

fn colors(&self) -> Vec<Color> {
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],
Expand Down