GithubHelp home page GithubHelp logo

giro's Introduction

giro

giro (from git-root) is a crate to for resolving the Git repository root directory, if any, of a path. So essentially, it enables you to find out two things:

  • Does a path belong to a Git repository?
  • If so, what is the root directory of this Git repository?

This crate only exposes one public function: 'git_root'

pub fn git_root<P: AsRef<std::path::Path>>(path: P) -> Result<Option<PathBuf>, std::io::Error>

Having this isolated functionality in a create means that other applications or crates may be able to use this crate over for example git2 or similar crates when they are only used for this functionality.

Usage

Library (crate)

Run

cargo add giro

or add

giro = "0.1"

to your projects Cargo.toml.

Then call it with

let root: Option<std::path::PathBuf> = giro::git_root("some/path")?;

Application (binary)

This will install giro as a git plugin. The binary will be installed as git-root.

cargo install giro

then run

git root

to check if the current directory is inside a git repository or not.

Man Pages

If you want man pages for the git-root binary, it can be added by copying the file git-root.1.man to a directory in your $MANPATH.

giro's People

Contributors

mantono avatar

Watchers

 avatar Kostas Georgiou avatar  avatar

giro's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.