Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.
/ git-o-clock Public archive

🕐 Git O'Clock : A git toolbox for use in terminal.

License

Notifications You must be signed in to change notification settings

theredfish/git-o-clock

Repository files navigation

Git Repository Manager PRs Welcome Build Status Join the chat at https://gitter.im/git-repo-manager/community

This repository is no longer maintained but will remain opened to anyone interested in the code.

GRM : A light git repository manager written in Rust for use in terminal

Available with :

  • Bash
  • Powershell (work in progress)
  • Zsh

Demo with bash

USAGE:
    grm(.exe) [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    add     Search and add your git repositories for a given path; default path is the current directory
    goto    Go to the repository directory
    help    Prints this message or the help of the given subcommand(s)
    list    List your saved repositories for the given pattern
    rm      Remove a git repository from the list

Getting started

Waiting the final installation process, you can use the following steps to install GRM :

Setup

Download the repository and build the binary

Clone the repository and build the project (with cargo or rustc, it's up to you) :

git clone git@github.com:theredfish/git-repo-manager.git
cd git-repo-manager
cargo build --release

Setup the installation folder

Linux

mkdir ~/.grm
cd git-repo-manager

# Copy the bash wrapper and the completion file
cp wrapper_scripts/grm.sh ~/.grm
cp completion_scripts/grm.bash-completion.sh ~/.grm

# Copy the binary
cp target/release/grm ~/.grm

Windows (powershell)

mkdir ~/.grm

Copy the powershell wrapper
cp grm.ps1 ~/.grm

# Copy the binary
cp target/release/grm.exe ~/.grm

Setup grm alias

Linux

# Edit your ~/.bashrc or your ~/.bash_aliases with these lines
source ~/.grm/grm.bash-completion.sh
alias grm='source ~/.grm/grm.sh'

# Reload your bashrc
source ~/.bashrc

Windows

More information here.

First you need to change your execution policy :

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Next, create your Windows Powershell profile if doesn't exist :

# Microsoft.PowerShell_profile.ps1 already exists
cd $env:USERPROFILE\Documents
md WindowsPowerShell
cd WindowsPowerShell
New-Item Microsoft.PowerShell_profile.ps1 -ItemType "file"

Then edit Microsoft.PowerShell_profile.ps1 to add your alias :

# You must split args one by one, grm can handle two arguments
function GrmCall {
    ~/.grm/grm.ps1 $args[0] $args[1]
}

Set-Alias grm GrmCall

Finally source your profile :

. $PROFILE

Development

Prerequisites

  • Rust 1.37

SQLite3

Install the following dependencies (it may change depending of your distribution):

# OS dependencies
sudo apt-get install libsqlite3-dev

# Diesel CLI with sqlite only
cargo install diesel_cli --no-default-features --features sqlite

Or avoid installing OS dependencies by playing with the bundled libsqlite3-sys in diesel_cli.

Manage wrapper scripts

TODO

Features

This project is work in progress, here the list of expected features :

must-have features

  • add repositories
  • list repositories
  • change directory for a given repository name
  • remove repository
  • refresh repositories (delete dead ones and add new ones)
  • list repositories with filters / pattern

nice-to-have features

  • parallelized search
  • categorize repositories
  • installation script

migrations and updates

  • automatic migrations
  • always make a save of grm.db before a migration
  • if a migration fails, restore the previous version

system wrappers

  • grm powershell script wrapper for built-in commands
  • grm bash script wrapper for built-in commands
  • bash auto-completion
  • powershell auto-completion
  • zsh auto-completion

not so sure