feat: better git-root and git-home for exec
This commit is contained in:
11
.local/bin/git-home
Executable file
11
.local/bin/git-home
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# git script that will return the path of the current git project.
|
||||
# can be used to execute commands in the directory as well.
|
||||
# uses git >= 2.13 --show-superproject-working-tree
|
||||
path=$(git rev-parse --show-toplevel);
|
||||
[[ $? -ne 0 ]] && exit $?
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$path";
|
||||
else
|
||||
cd $path && exec "$@";
|
||||
fi
|
||||
@@ -1,9 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# git script that will return the root path of a git project, even if currently in a submodule.
|
||||
# can be used to execute commands in the root directory as well.
|
||||
# uses git >= 2.13 --show-superproject-working-tree
|
||||
superproject=$(git rev-parse --show-superproject-working-tree)
|
||||
if [ -z "$superproject" ]; then
|
||||
git rev-parse --show-toplevel;
|
||||
else
|
||||
echo "$superproject";
|
||||
path=$(git rev-parse --show-superproject-working-tree)
|
||||
[[ $? -ne 0 ]] && exit $?
|
||||
if [ -z "$path" ]; then
|
||||
path=$(git rev-parse --show-toplevel);
|
||||
fi
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$path";
|
||||
else
|
||||
cd $path && exec "$@";
|
||||
fi
|
||||
|
||||
3
.local/bin/i3.sh
Normal file
3
.local/bin/i3.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
source ~/.profile
|
||||
i3
|
||||
Reference in New Issue
Block a user