-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified names for better namespace safety
- Loading branch information
Showing
9 changed files
with
181 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Imports. | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "$SCRIPT_DIR"/colors.sh | ||
source "$SCRIPT_DIR"/functions.sh | ||
SHUNPO_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "$SHUNPO_SCRIPT_DIR"/colors.sh | ||
source "$SHUNPO_SCRIPT_DIR"/functions.sh | ||
|
||
# File to store bookmarks. | ||
MAX_BOOKMARKS=128 | ||
SHUNPO_MAX_BOOKMARKS=128 | ||
|
||
# Ensure the bookmarks file exists and is not empty | ||
if [ ! -f "$BOOKMARKS_FILE" ]; then | ||
touch "$BOOKMARKS_FILE" | ||
if [ ! -f "$SHUNPO_BOOKMARKS_FILE" ]; then | ||
touch "$SHUNPO_BOOKMARKS_FILE" | ||
fi | ||
|
||
# Check the number of existing bookmarks. | ||
current_bookmarks=$(wc -l <"$BOOKMARKS_FILE") | ||
current_bookmarks=$(wc -l <"$SHUNPO_BOOKMARKS_FILE") | ||
|
||
# If the bookmarks list is full, print a message and do not add the new bookmark. | ||
if [ "$current_bookmarks" -ge "$MAX_BOOKMARKS" ]; then | ||
echo -e "${CYAN}${BOLD}Bookmarks list is full!${RESET} Maximum of $MAX_BOOKMARKS bookmarks allowed." | ||
if [ "$current_bookmarks" -ge "$SHUNPO_MAX_BOOKMARKS" ]; then | ||
echo -e "${SHUNPO_CYAN}${SHUNPO_BOLD}Bookmarks list is full!${SHUNPO_RESET} Maximum of $SHUNPO_MAX_BOOKMARKS bookmarks allowed." | ||
exit 1 | ||
fi | ||
|
||
# Save the current directory to the bookmarks file. | ||
current_dir=$(realpath "$PWD") | ||
if ! grep -q -x "$(printf '%s\n' "$current_dir")" "$BOOKMARKS_FILE"; then | ||
echo "$current_dir" >>"$BOOKMARKS_FILE" | ||
echo -e "${GREEN}${BOLD}Bookmark added:${RESET} $current_dir" | ||
if ! grep -q -x "$(printf '%s\n' "$current_dir")" "$SHUNPO_BOOKMARKS_FILE"; then | ||
echo "$current_dir" >>"$SHUNPO_BOOKMARKS_FILE" | ||
echo -e "${SHUNPO_GREEN}${SHUNPO_BOLD}Bookmark added:${SHUNPO_RESET} $current_dir" | ||
else | ||
echo -e "${ORANGE}${BOLD}Bookmark exists:${RESET} $current_dir" | ||
echo -e "${SHUNPO_ORANGE}${SHUNPO_BOLD}Bookmark exists:${SHUNPO_RESET} $current_dir" | ||
fi |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Colors and formatting. | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "$SCRIPT_DIR"/colors.sh | ||
source "$SCRIPT_DIR"/functions.sh | ||
SHUNPO_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "$SHUNPO_SCRIPT_DIR"/colors.sh | ||
source "$SHUNPO_SCRIPT_DIR"/functions.sh | ||
|
||
# Remove the bookmarks file if it exists. | ||
if [ ! -f "$BOOKMARKS_FILE" ] || [ ! -s "$BOOKMARKS_FILE" ]; then | ||
echo -e "${ORANGE}${BOLD}No Bookmarks Found.${RESET}" | ||
if [ ! -f "$SHUNPO_BOOKMARKS_FILE" ] || [ ! -s "$SHUNPO_BOOKMARKS_FILE" ]; then | ||
echo -e "${SHUNPO_ORANGE}${SHUNPO_BOLD}No Bookmarks Found.${SHUNPO_RESET}" | ||
exit 1 | ||
|
||
else | ||
rm "$BOOKMARKS_FILE" | ||
echo -e "${RED}${BOLD}Cleared Bookmarks.${RESET}" | ||
rm "$SHUNPO_BOOKMARKS_FILE" | ||
echo -e "${SHUNPO_RED}${SHUNPO_BOLD}Cleared Bookmarks.${SHUNPO_RESET}" | ||
fi |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
CYAN='\033[36m' | ||
ORANGE='\033[38;5;208m' | ||
GREEN='\033[38;5;43m' | ||
RED='\033[38;5;203m' | ||
BOLD='\033[1m' | ||
RESET='\033[0m' | ||
SHUNPO_CYAN='\033[36m' | ||
SHUNPO_ORANGE='\033[38;5;208m' | ||
SHUNPO_GREEN='\033[38;5;43m' | ||
SHUNPO_RED='\033[38;5;203m' | ||
SHUNPO_BOLD='\033[1m' | ||
SHUNPO_RESET='\033[0m' |
Oops, something went wrong.