-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
István Bozsó
committed
Jun 10, 2019
1 parent
2fd3659
commit 0c3e348
Showing
4 changed files
with
113 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#! /usr/bin/env sh | ||
|
||
check_narg() { | ||
if [ "$1" -lt "$2" ]; then | ||
perr "error: Wrong number of arguments!" | ||
return 1 | ||
fi | ||
} | ||
|
||
git_remote_add() { | ||
check_narg $# 1 | ||
|
||
git remote add origin "$1" | ||
} | ||
|
||
|
||
git_push() { | ||
check_narg $# 1 | ||
|
||
git commit -am "$*" | ||
git push origin master | ||
} | ||
|
||
|
||
main() { | ||
check_narg "$#" "1" | ||
|
||
case $1 in | ||
"stat") | ||
git status | ||
;; | ||
"push") | ||
shift | ||
echo "$@" | ||
git_push "$@" | ||
;; | ||
"pull") | ||
git pull origin master | ||
;; | ||
*) | ||
printf "Unrecognized option %s!\n" $1 >&2 | ||
return 1 | ||
;; | ||
esac | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# hash() { | ||
# echo $((0x$(sha1sum <<<"$1")0)) | ||
# } | ||
|
||
|
||
in_str() { | ||
local reqsubstr="$1" | ||
shift | ||
local string="$@" | ||
|
||
if [ -z "${string##*$reqsubstr*}" ]; then | ||
echo "true" | ||
else | ||
echo "false" | ||
fi | ||
} | ||
|
||
|
||
key() { | ||
if [ -n "$1" ]; then | ||
printf "%s" "$1" | awk -F ':' '{print $1}' | ||
else | ||
printf "%s" | awk -F ':' '{print $1}' | ||
fi | ||
} | ||
|
||
value() { | ||
if [ -n "$1" ]; then | ||
echo "$(printf "%s\n" "$1" | awk -F ':' '{print $NF}' | tr -d '\n')" | ||
else | ||
echo "$(printf "%s\n" | awk -F ':' '{print $NF}' | tr -d '\n')" | ||
fi | ||
} | ||
|
||
mget() { | ||
local key="$1" | ||
local table="$2" | ||
|
||
for line in $table; do | ||
if [ "$(in_str "$key" "$line")" = "true" ]; then | ||
echo "$(value "$line")" | ||
fi | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ tar_ext() { | |
|
||
|
||
gm() { | ||
sh $UTILS_DIR/menu.sh git $* | ||
sh $UTILS_DIR/tools/git.sh $* | ||
} | ||
|
||
|
||
|