Skip to content

Commit 0d2ea86

Browse files
Cleaned up code
Signed-off-by: The-Repo-Club <[email protected]>
1 parent ec59e08 commit 0d2ea86

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

proctl

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# GitHub - https://github.com/The-Repo-Club/
66
# Author - The-Repo-Club [[email protected]]
77
# Start On - Fri 18 February 2022, 07:26:28 pm (GMT)
8-
# Modified On - Tue 22 February 2022, 10:49:20 pm (GMT)
8+
# Modified On - Tue 22 February 2022, 11:31:07 pm (GMT)
99
# -------------------------------------------------------------------------
1010
#
1111
#
@@ -66,15 +66,15 @@ sed_escape() { printf '%s\n' "${1//\\/\\\\}"; }
6666
list_licenses() {
6767
for File in "$LICENSE_DIR"/*; {
6868
if [[ -f $File ]]; then
69-
printf " $BRIGHT*$RESET @%s\n" "$(basename $File)"
69+
printf " $BRIGHT*$RESET @%s\n" "${File##*/}"
7070
fi
7171
}
7272
}
7373

7474
list_languages() {
7575
for File in "$LANGUAGE_DIR"/*; {
7676
if [[ -f $File ]]; then
77-
printf " $BRIGHT*$RESET @%s\n" "$(basename $File)"
77+
printf " $BRIGHT*$RESET @%s\n" "${File##*/}"
7878
fi
7979
}
8080
}
@@ -84,35 +84,35 @@ usage() {
8484
Github Project Manager v$VERSION
8585
manage, switch between templated licenses, and set languages
8686
87-
AUTHOR_NAME -- '$AUTHOR_NAME'
88-
AUTHOR_EMAIL -- '$AUTHOR_EMAIL'
89-
AUTHOR_WEBSITE -- '$AUTHOR_WEBSITE'
90-
AUTHOR_GIT -- '$AUTHOR_GIT'
91-
LICENSE_DIR -- '$LICENSE_DIR'
92-
LANGUAGE_DIR -- '$LANGUAGE_DIR'
93-
94-
[ENV=VAL ...] $(basename "$0") <flag>
95-
96-
-initialize -i @project_name initialize a git repo for a project
97-
-list-licenses -l list available licenses
98-
-list-languages -ll list available languages
99-
-current-license -c show current active project license
100-
-pick-license -p pick a license in a FZF menu
101-
-pick-language -pl pick a language in a FZF menu
102-
-preview-license -P @license_name preview a license template
103-
-remove-license -r remove all licenses from the current project
104-
-search-license -s '<query | patten>' search for license
105-
-template-help -T print help for templating
106-
-new-template -t create a new license template
107-
-delete-license -R @license_name ... delete a license from templates
108-
-new-config -C create a default config overwriting current one
109-
-check-conflict -k check if current licene(s) are conflicting
110-
111-
-help -h show this helpful list of commands
112-
113-
PROCTL_COLOURS=0|[1] turn colour on (1) or off (0) [${PROCTL_COLOURS:-1}]
87+
AUTHOR_NAME -- '$AUTHOR_NAME'
88+
AUTHOR_EMAIL -- '$AUTHOR_EMAIL'
89+
AUTHOR_WEBSITE -- '$AUTHOR_WEBSITE'
90+
AUTHOR_GIT -- '$AUTHOR_GIT'
91+
LICENSE_DIR -- '$LICENSE_DIR'
92+
LANGUAGE_DIR -- '$LANGUAGE_DIR'
93+
94+
[ENV=VAL ...] ${0##*/} <flag>
95+
96+
-initialize -i @project_name initialize a git repo for a project
97+
-list-licenses -l list available licenses
98+
-list-languages -ll list available languages
99+
-current-license -c show current active project license
100+
-pick-license -p pick a license in a FZF menu
101+
-pick-language -pl pick a language in a FZF menu
102+
-preview-license -P @license_name preview a license template
103+
-remove-license -r remove all licenses from the current project
104+
-search-license -s '<query | patten>' search for license
105+
-template-help -T print help for templating
106+
-new-template -t create a new license template
107+
-delete-license -R @license_name ... delete a license from templates
108+
-new-config -C create a default config overwriting current one
109+
-check-conflict -k check if current licene(s) are conflicting
110+
111+
-help -h show this helpful list of commands
112+
113+
PROCTL_COLOURS=0|[1] turn colour on (1) or off (0) [${PROCTL_COLOURS:-1}]
114114
EOF
115-
115+
echo " this"
116116
printf '%s' "$REPLY"
117117
}
118118

@@ -124,7 +124,7 @@ usage() {
124124
make_new_config() {
125125
mkdir -p "$HOME"/.config
126126

127-
#=== DEFAULT CONFIG ===========================================================
127+
#=== DEFAULT CONFIG ===========================================================
128128

129129
read -d '' <<-EOF
130130
#!/usr/bin/env sh
@@ -148,7 +148,7 @@ make_new_config() {
148148

149149
echo "$REPLY" >"$LANGUAGE_CONF"
150150

151-
#==============================================================================
151+
#==============================================================================
152152
}
153153

154154
#=== FUNCTION =================================================================
@@ -302,7 +302,7 @@ get_license() {
302302
cp -rfL "$LICENSE_DIR"/"$user_license" "$l_name"
303303

304304
sed -i "$l_name" \
305-
-e "s/{{PROJECT_NAME}}/$(sed_escape "$(basename "$PWD")")/g" \
305+
-e "s/{{PROJECT_NAME}}/$(sed_escape "${PWD/##*/}")/g" \
306306
-e "s/{{CURRENT_YEAR}}/$(sed_escape "$(date '+%Y')")/g" \
307307
-e "s/{{AUTHOR_NAME}}/$(sed_escape "$AUTHOR_NAME")/g" \
308308
-e "s/{{AUTHOR_EMAIL}}/$(sed_escape "$AUTHOR_EMAIL")/g" \
@@ -352,7 +352,7 @@ get_language() {
352352
cp -rfL "$LANGUAGE_DIR"/"$user_language" "$l_name"
353353

354354
sed -i "$l_name" \
355-
-e "s/{{PROJECT_NAME}}/$(sed_escape "$(basename "$l_name")")/g" \
355+
-e "s/{{PROJECT_NAME}}/$(sed_escape "${l_name##*/}")/g" \
356356
-e "s/{{AUTHOR_WEBSITE}}/$(sed_escape "$AUTHOR_WEBSITE")/g" \
357357
-e "s/{{CURRENT_DATE}}/$(sed_escape "$(date '+%a %d %B %Y, %I:%M:%S %P (%Z)')")/g" \
358358
-e "s/{{AUTHOR_EMAIL}}/$(sed_escape "$AUTHOR_EMAIL")/g" \
@@ -371,7 +371,7 @@ get_language() {
371371
exit 8
372372
fi
373373

374-
depend "$(basename "$editor")"
374+
depend "${editor##*/}"
375375

376376
set -x
377377
$editor "$l_name"
@@ -535,13 +535,13 @@ new_template() {
535535
exit 8
536536
fi
537537

538-
depend "$(basename "$editor" | awk '{print $1}')"
538+
depend "${editor##*/}"
539539

540540
set -x
541541
$editor "$ln"
542542
set +x
543543

544-
[[ -f "$ln" ]] && einfo "License '$(basename "$ln")' saved"
544+
[[ -f "$ln" ]] && einfo "License '${ln##*/}' saved"
545545

546546
elif [[ "$type" == "language" ]]; then
547547
read -p 'Language name/alias (spaces will be removed) -- '
@@ -570,13 +570,13 @@ new_template() {
570570
exit 8
571571
fi
572572

573-
depend "$(basename "$editor" | awk '{print $1}')"
573+
depend "${editor##*/}"
574574

575575
set -x
576576
$editor "$ln"
577577
set +x
578578

579-
[[ -f "$ln" ]] && einfo "Language '$(basename "$ln")' saved"
579+
[[ -f "$ln" ]] && einfo "Language '${ln##*/}' saved"
580580
fi
581581
}
582582

0 commit comments

Comments
 (0)