See on GitHub

sense-rs

Sense the directories around you, are they git repositories, what language, etc.

Rust

Languages

:snake: sense-py || :crab: sense-rs || :hamster: gosense || 🇨 sense-c

Why?

Why so many langs?

Because I write projects pretty regularly in all of these languages and want a consistent API and available library support for all of them.

API

Git

has_git(path: String) -> bool;
is_local_git(path: String) -> bool;

Language

get_lang(path: String) -> Lang;

Example

fn main() {
    let language = get_lang("./".to_string());
    println!("{}", language);

    let git_dir = has_git("./".to_string());
    if git_dir {
        println!("Is git!");
    } else {
        println!("Is not git.");
    }

    let local = is_local_git("./".to_string());
    if local {
        println!("Is local!");
    } else {
        println!("Is not local.");
    }
}

Supported langs

  • Python
  • JavaScript
  • Rust
  • Java
  • Go
  • TypeScript
  • C
  • CPP

Contributing

If you would like to add features or language support, that would be amazing!