Skip to content

Commit

Permalink
docs: revamp readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnossiom committed May 9, 2024
1 parent 6399df8 commit b8ef534
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 22 deletions.
101 changes: 85 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,65 @@
<p align="center">
<img alt="git-leave logo" src="https://raw.githubusercontent.com/mrnossiom/git-leave/main/assets/logo.png">
</p>

![Git Leave Logo](https://raw.githubusercontent.com/mrnossiom/git-leave/main/assets/logo.png)

<strong>
<p align="center"><strong>
Check for unsaved or uncommitted changes on your machine
</strong>

![Nix Powered](https://img.shields.io/badge/Nix-Powered-blue?logo=nixos)
[![Cachix Cache](https://img.shields.io/badge/cachix-mrnossiom-blue.svg)](https://mrnossiom.cachix.org)
</strong></p>

<p align="center">
<img alt="Nix Powered" src="https://img.shields.io/badge/Nix-Powered-blue?logo=nixos" />
<a src="https://mrnossiom.cachix.org">
<img alt="Cachix Cache" src="https://img.shields.io/badge/cachix-mrnossiom-blue.svg" />
</a>
</p>

# Usage
# Installation

Set the `leaveTool.defaultFolder` key in your git global configuration file to use the `--default` or `-d` flag.
<details>
<summary>With <code>cargo</code> via <code>crates.io</code></summary>

```conf
# Your global .gitconfig
[leaveTool]
defaultFolder = ~/path/to/projects
Install from repository with cargo:

```sh
cargo install git-leave
```

You will also need `openssl` library in path, which you can install over you prefered package manager.

</details>

<details>
<summary>With <code>nix</code> flakes</summary>

A `flake.nix` is available which means that you can use `github:mrnossiom/git-leave` as a flake identifier, so you can.

- import this repository in your flake inputs

```nix
{
git-leave.url = "github:mrnossiom/git-leave";
git-leave.inputs.nixpkgs.follows = "nixpkgs";
}
```

Add the package to your [NixOS](https://nixos.org/) or [Home Manager](https://github.com/nix-community/home-manager) packages depending on your installation.

- use with `nix shell`/`nix run` for temporary testing

e.g. `nix shell github:mrnossiom/git-leave`

- use with `nix profile` for imperative installation

e.g. `nix profile install github:mrnossiom/git-leave`

Package is reachable through `packages.${system}.default` or `packages.${system}.git-leave`.

</details>

# Usage

```
Check for unsaved or uncommitted changes on your machine.
Check for unsaved or uncommitted changes on your machine
Usage: git-leave [OPTIONS] [DIRECTORY]
Expand All @@ -38,6 +75,38 @@ Options:
-V, --version Print version
```

## Credits
- To check all repos under the current directory

```sh
git leave
```

- To check all repos under the specified directory

```sh
git leave path/to/directory
```
- To check all repos under the default directory (see config)

```sh
git leave --default
```

# Config

Set the `leaveTool.defaultFolder` key in your git global configuration file to use the `--default` or `-d` flag.

In `.config/git/config`, or any other git config file:
```conf
[leaveTool]
defaultFolder = ~/path/to/projects
```

# Credits

- **[woobuc/sweep](https://github.com/woobuc/sweep)** for many concepts I implemented here (e.g. threads, logging)

---

Work is licensed under [`CECILL-2.1`](https://choosealicense.com/licenses/cecill-2.1/), a French OSS license that allows modification and distribution of the software while requiring the same license for derived works.

- **[woobuc/sweep](https://github.com/woobuc/sweep)** for many concept I implemented here (threads, logging)
12 changes: 6 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ use clap::Parser;
use git2::Config as GitConfig;
use label_logger::error;

/// Check for unsaved or uncommitted changes on your machine.
/// Check for unsaved or uncommitted changes on your machine
#[derive(Parser)]
#[clap(name = "git-leave", about, version, author, long_about = None)]
#[allow(clippy::struct_excessive_bools)]
pub struct Arguments {
/// The directory to search in
/// Directory to search in
#[clap(default_value_t = String::from("."))]
pub directory: String,

/// Use git config default folder value for the directory to search in
/// Use default folder specified in git config for the directory to search in
#[clap(long, short)]
pub default: bool,

/// Should we follow symlinks
/// Follow symlinks
#[clap(long)]
pub follow_symlinks: bool,

/// Should we show the directories we are actually crawling
/// Show the directories we are actually crawling
#[clap(long)]
pub show_directories: bool,

/// The number of cores to use for crawling
/// Number of cores to use for crawling
#[clap(long, default_value_t = num_cpus::get())]
pub threads: usize,
}
Expand Down

0 comments on commit b8ef534

Please sign in to comment.