Skip to content

A collection of Unix scripts to ease my life. Mostly around git.

License

Notifications You must be signed in to change notification settings

ptitfred/posix-toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

posix-toolbox

About

A collection of Unix scripts to ease my life. Mostly around git.

It's very personal and you might find some ideas in it but I doubt anybody would properly use it as is.

What's in the toolbox

Highlighted tools I use on a daily basis:

  • git-bubbles, a git script to handle pull requests
  • git-checkout-log, a git script to browser reflog and follow checkouts
  • git-tree, a git script to tree files handled by git
  • wait-tcp, a script to wait for some server sockets to be opened on a TCP

2 source-able bash scripts to customize your terminal:

Other scripts live alond but I don't use them directly, see below.

How-to install

This project relies on nix, and flakes must be enabled.

Install via home-manager as a module

I'm using home-manager for my whole setup and this is therefore my recomended way to use it. It's the best supported way to use it as it sources scripts for you:

{
  inputs = {
    home-manager.url = "github:nix-community/home-manager/release-24.05";
    ptitfred-posix-toolbox.url = "github:ptitfred/posix-toolbox";
  };

  outputs = { home-manager, ptitfred-posix-toolbox }: {
    homeManagerConfigurations.frederic = home-manager.lib.homeManagerConfiguration {
      modules = [
        ptitfred-posix-toolbox.homeManagerModules.default
        ./your-home.nix
      ];
    };
  }
}

The your-home.nix file might contain:

{ ... }:

{
  ptitfred.posix-toolbox.enable = true;

  # Options for the git-bubbles script:
  ptitfred.posix-toolbox.git-bubbles.remote-name = "some-remote-name";
  ptitfred.posix-toolbox.git-bubbles.pattern = "---";

  # You might have to enable git though:
  programs.git.enable = true;

  # If you have bash enabled ls-colors and git-ps1 are sources:
  programs.bash.enable = true;
}

You could then use it on your machine with the switch command:

nix run home-manager/release-24.05 -- switch --flake .#frederic

You can learn more about home-manager via their official documentation or by examples via my own configuration.

Install via a profile

A more imperative approach: you can install it in your user's path this way:

nix profile install github:ptitfred/posix-toolbox

It doesn't source the PS1 for you nor the bash colors though. Shame!

Test from a shell

If you want to poke around and try the scripts, you can launch a shell as a temporary setup:

nix shell github:ptitfred/posix-toolbox

Other scripts

Other scripts I used to use or are used here:

  • git-authors, a git script to list committers other a commit range
  • git-prd, a git script to display the path of the root of a git repository relative to your HOME directory
  • git-pwd, a git script to display the path relative to the root of a git repository
  • git-rm-others, a git script to clean the working copy from untracked files
  • git-search, a git script to search the diff other a commit range
  • git-short, a git script to display short SHA1 of a given commit
  • git-std-init, a git script to setup a repository with an initial empty commit and a base and master branches
  • prd, a script to print the working directory relative to your HOME directory
  • repeat, a script to repeat a command some times
  • short-path, a script to abbreviate every directory unless the last part of a path

Those scripts can be installed by the home-manager module with the ptitfred.posix-toolbox.extras flag.


Copyright © 2010-, Frédéric Menou and Céline Louvet. Licensed under MIT License.