diff --git a/README.org b/README.org deleted file mode 100644 index 226220b..0000000 --- a/README.org +++ /dev/null @@ -1,58 +0,0 @@ -#+title: gra -#+subtitle: Add new Git remotes quickly - - -/gra/ (short for =git remote add=) is a small Bash script which allows to add new Git remotes easily. -New remote URLs will be added with the same URL scheme as the one of the =origin= remote. -The only argument which is needed is a =REMOTE_NAME=, - -#+begin_example - $ gra Deleh - Adding remote origin-Deleh with URL git@github.com:Deleh/example.git - Fetching from remote origin-Deleh - From github.com:Deleh/example - * [new branch] main -> origin-Deleh/main -#+end_example - -* Usage - -#+begin_example - Usage: gra [OPTIONS] REMOTE_NAME - - Add a Git remote by providing a single name. All remotes get listed if no - REMOTE_NAME is provided. - - REMOTE_NAME Name of the remote - - OPTIONS - -h, --help Show this help message and exit -#+end_example - -** Shorthands - -Shorthands can be defined in =~/.config/gra.config= for example like this: - -#+begin_src sh - ex=example - slu=SuperLongUsername -#+end_src - -They can be passed as =REMOTE_NAME= argument, which is handy for often-used, long remote names. -Autocompletion is available for all defined shorthands. - -* Installation - -** Manual - -Place the =gra= script in your =$PATH=. -To use the autocompletion feature source the =gra_completion.bash= script. - -** Script - -An installation script for Bash (=install.bash=) is provided which will link the two files to =~/.local/{bin/gra,share/bash-completion/completions/gra}= and add the corresponding entries to =~/.bashrc=. -Further updates of /gra/ require just =git pull=. - -** Nix Flake - -This repository is also a [[https://nixos.wiki/wiki/Flakes][Nix Flake]]. -/gra/ is provided as package under =github:Deleh/gra#gra=. diff --git a/flake.lock b/flake.lock index a046407..e09000a 100644 --- a/flake.lock +++ b/flake.lock @@ -3,8 +3,8 @@ "nixpkgs": { "locked": { "lastModified": 0, - "narHash": "sha256-+CHVZnTnIYRLYsARInHYoWkujzcRkLY/gXm3s5bE52o=", - "path": "/nix/store/7840m01bg4qkhh3kq6mlrsi3s352qkc1-source", + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "path": "/nix/store/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source", "type": "path" }, "original": { diff --git a/flake.nix b/flake.nix index 6aae464..9b6c572 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Add new Git remotes easily"; + description = "Add new Git remotes quickly"; outputs = { self, nixpkgs }@inputs: let forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix; diff --git a/gra b/gra index f213ebe..c820ffe 100755 --- a/gra +++ b/gra @@ -9,8 +9,8 @@ function print_usage { cat < /dev/null; then error "Not inside a Git repository" fi -# Show remotes if no remote name was passed -if [ "$remote_name" == "" ]; then - echo -e "Argument ${text_bold}REMOTE_NAME${text_reset} not provided, listing remotes\n" - git remote -v - exit 0 -fi - # Read config [ -f ~/.config/gra.config ] && source ~/.config/gra.config diff --git a/install.bash b/install.bash deleted file mode 100644 index dc52a92..0000000 --- a/install.bash +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# Adds $1 to ~/.bashrc if not already present -function _add_to_config { - if ! grep "$1" ~/.bashrc > /dev/null; then - echo "$1" >> ~/.bashrc - fi -} - -# Link files -basedir="$(dirname "$(realpath "$0")")" -mkdir -p ~/.local/{bin,share/bash-completion/completions} -ln -frs "${basedir}/gra" ~/.local/bin/gra -echo "Created link '~/.local/bin/gra'" -ln -frs "${basedir}/gra_completion.bash" ~/.local/share/bash-completion/completions/gra -echo "Created link '~/.local/share/bash-completion/completions/gra'" - -# Modify bashrc -touch ~/.bashrc -_add_to_config "export PATH=\$PATH:${HOME}/.local/bin" -_add_to_config "source ${HOME}/.local/share/bash-completion/completions/gra" -echo "Updated '~/.bashrc'" - -echo -echo "Source ~/.bashrc to use gra" -echo "To update gra in future execute 'git pull' in '${basedir}'"