Git Product home page Git Product logo

.sh-files's Introduction

.sh-files

Shome shell junk. Thish'sh for myshelf, becaushe I can't remember shi~, and thish, shomeday, may shave me a couple of hoursh...

Setup

Someday I'll write a Makefile for doing all this cumbersome work, but for now...

Prerequisites

  • zsh, though good old bash with .bash_profile will do.
  • The coreutils package installed on macOS (brew install coreutils).
  • This repository cloned as .sh-files to ~:
$ cd ~ && git clone https://github.com/arcdelta/.sh-files.git

How do I use dem aliases and stuff?

You can either copy-paste the code below into your .zshrc:

# Sh-files injection
export SHFILES="$HOME/.sh-files"

source "$SHFILES/loader.sh"
include $SHFILES/rc \*

or echo it there directly from shell:

$ echo '# Sh-files injection
export SHFILES="$HOME/.sh-files"

source "$SHFILES/loader.sh"
include $SHFILES/rc \*' >> ~/.zshrc

Note. If you're not sure what one or another alias stands for, you can simply use which <aliases>.

$ which gcm gai
gai: aliased to git add --interactive
gcm: aliased to git commit -m

Where should I place dem binaries, bruh?

For convenient usage it's advised to place them inside /usr/local/bin, $HOME/bin or $HOME/.local/bin. There's no consensus on this topic, but I'm personally leaning towards the last option. Anyway, don't forget to add the directory of your choice to the PATH environment variable (if it's not there already).

What do I do to use dis sleek commit hack?

Let's say you decided to go with the $HOME/.local/bin option. Check if $HOME/.local/bin is already in the PATH:

$ echo $PATH | grep $HOME/.local/bin

If a string with $HOME/.local/bin in it is returned, then you're good to go and can either create a symlink to a binary, or manually put it into $HOME/.local/bin.

If nothing is returned, you can add $HOME/.local/bin into your .zshrc like that:

$ printf '\n# PATH\nexport PATH="$HOME/.local/bin:$PATH"\n' >> ~/.zshrc

or use the default editor (if it's not set, it'll fallback to vi):

$ "${EDITOR:-vi}" ~/.zshrc

or, if you're a wuss, just use vscode:

$ code ~/.zshrc

Then, hold yourself firmly in the .sh-files directory:

$ pwd
/Users/vm/.sh-files

Create a symlink:

$ ln -s `pwd`/bin/cm $HOME/.local/bin/fake-the-date

Make it executable, then source the config or reopen terminal:

$ chmod +x $HOME/.local/bin/fake-the-date
$ source ~/.zshrc

Test it:

$ fake-the-date
cm: You should specify the commit message and (optionally) the date

Usage: cm [message] [[date]]

Examples:
$ cm 'Plant a tree' '2 days ago'
$ cm 'Create yet another framework' '1 hour ago'
$ cm 'Raise a kid' '2019-11-11 12:35:18'

.sh-files's People

Contributors

norskeld avatar

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.