summaryrefslogtreecommitdiff
path: root/.local/bin/development
diff options
context:
space:
mode:
authorVikas Kushwaha <dev@vikas.rocks>2025-01-10 15:08:05 +0530
committerVikas Kushwaha <dev@vikas.rocks>2025-01-10 15:08:05 +0530
commite02304f014645a01ef6cdd40276997dea58504d9 (patch)
tree49ac70d8b348fa138f681e2fe6fa8f92b512ec9e /.local/bin/development
parent776f17159bccd342bdc8ab9afdd035196f48d385 (diff)
Cleaning up 'bin' folder.
Diffstat (limited to '.local/bin/development')
-rwxr-xr-x.local/bin/development/dev22
-rwxr-xr-x.local/bin/development/github-repo-size3
-rwxr-xr-x.local/bin/development/gitpush26
3 files changed, 32 insertions, 19 deletions
diff --git a/.local/bin/development/dev b/.local/bin/development/dev
index 76f1772..bcb5b46 100755
--- a/.local/bin/development/dev
+++ b/.local/bin/development/dev
@@ -33,6 +33,7 @@ md_test() { pandoc -t pdf "$file" | zathura -; }
tex_compile() { pdflatex -output-directory="$(dirname "$file")" "$file"; }
tex_clean() { find "$(dirname "${1}")" -regex \
'.*\(_minted.*\|.*\.\(4tc\|xref\|tmp\|pyc\|pyg\|pyo\|fls\|vrb\|fdb_latexmk\|bak\|swp\|aux\|log\|synctex\(busy\)\|lof\|lot\|maf\|idx\|mtc\|mtc0\|nav\|out\|snm\|toc\|bcf\|run\.xml\|synctex\.gz\|blg\|bbl\)\)' -delete; }
+cls_compile() { file="${file%.cls}.tex"; tex_compile "$@"; }
html_format() { tidy -q "$file" 2>/dev/null; }
html_lint() { tidy -q "$file" >/dev/null; }
html_run() { w3m "$file"; }
@@ -138,6 +139,7 @@ case $filetype in
text/x-shellscript) filetype_ext="sh" ;;
text/html) filetype_ext="html" ;;
application/javascript) filetype_ext="js" ;;
+ application/json) filetype_ext="json" ;;
text/x-php) filetype_ext="php" ;;
text/x-awk) filetype_ext="awk" ;;
esac
@@ -150,17 +152,15 @@ else
fi
execute_task() {
- [ "$NO_BASENAME" != 1 ] && {
- file_task="${file_ext}_${action}"
- [ "${tasks#*"[$file_task]"}" != "$tasks" ] &&
- { $file_task; local ret=$?; local tasked=1; }
- }
- [ "$tasked" != 1 ] && {
- filetype_task="${filetype_ext}_${action}"
- [ "${tasks#*"[$filetype_task]"}" != "$tasks" ] &&
- { $filetype_task; local ret=$?; local tasked=1; }
- }
- [ "$tasked" != 1 ] && return 1
+ file_task="${file_ext}_${action}"
+ filetype_task="${filetype_ext}_${action}"
+ if [ "$NO_BASENAME" != 1 ] && [ "${tasks#*"[$file_task]"}" != "$tasks" ]; then
+ $file_task; ret=$?
+ elif [ "${tasks#*"[$filetype_task]"}" != "$tasks" ]; then
+ $filetype_task; ret=$?
+ else
+ return 1
+ fi
[ "$ret" != 0 ] && printf "\nshell returned %s\n" "$ret" >&2
return 0
}
diff --git a/.local/bin/development/github-repo-size b/.local/bin/development/github-repo-size
new file mode 100755
index 0000000..0cedd88
--- /dev/null
+++ b/.local/bin/development/github-repo-size
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo "$1" | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -i curl -s -k https://api.github.com/repos/'{}' | grep size
diff --git a/.local/bin/development/gitpush b/.local/bin/development/gitpush
index 97aa43b..0af8e20 100755
--- a/.local/bin/development/gitpush
+++ b/.local/bin/development/gitpush
@@ -1,10 +1,20 @@
#!/bin/sh
-case "$(git config --get remote.origin.url)" in
- *csstudent41*) sshadd ~/.ssh/github.com_id_ed25519 ;;
- *labstudent41*) sshadd ~/.ssh/labstudent41_id_ed25519 ;;
-esac
-
-git add --all
-git commit # --allow-empty-message
-git push -u origin
+push_to_remote() {
+ case "$(git config --get remote.origin.url)" in
+ *csstudent41*) sshadd ~/.ssh/github.com_id_ed25519 ;;
+ *labstudent41*) sshadd ~/.ssh/labstudent41_id_ed25519 ;;
+ *vtc-tech*) sshadd ~/.ssh/vartaktechclub_id_ed25519 ;;
+ esac
+
+ git add --all
+ git commit
+ git push -u origin
+}
+
+[ -z "$1" ] && { push_to_remote; exit; }
+
+for dir in "$@"; do
+ cd "$dir" || exit 1
+ push_to_remote
+done