-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions
47 lines (39 loc) · 1.05 KB
/
functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function ij() {
open -na "IntelliJ IDEA.app" --args "$@"
}
function code {
if [[ $# = 0 ]]; then
open -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
touch "$argPath"
open -a "Visual Studio Code" "$argPath"
fi
}
function psgrep() {
if [ -n "$1" ]; then
echo "Grepping for processes matching '$1'…"
pgrep "$1"
else
echo "You need to provide an argument for which I can grep!"
fi
}
function delete_branch() {
echo -e "Deletes a branch both locally and remotely or prunes local reference if it has already been deleted from remote\n"
echo -e "Assumes \"origin\" as remote alias\n"
git push -d origin "${1}"
git branch -d "${1}"
git branch -r --delete origin/"${1}"
}
function rename_extension() {
# check if the input file and new extension are provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <file> <new_extension>"
exit 1
fi
filename="$1"
new_extension="$2"
# Rename the file extension
mv "$filename" "${filename%.*}.$new_extension"
}