Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgnunes committed Jan 11, 2025
1 parent 4d62685 commit 2f7ad26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .helper-scripts/accessed-recently.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ _clean_up_accessed_files() {
# for sorted display.
local count=1
for file in "${files[@]}"; do
mv "$file" "$ACCESSED_RECENTLY_DIR/$(printf '%02d' $count) $(basename "$file" | sed 's/^\([0-9]\{2\} \)*//')"
mv "$file" "$ACCESSED_RECENTLY_DIR/$(printf '%02d' $count) $(basename "$file" | sed 's|^\([0-9]\{2\} \)*||')"
((count++))
done
}
Expand Down
6 changes: 3 additions & 3 deletions Git/Open the repository website
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ _convert_git_to_web_url() {
web_url="${git_url%.git}"
elif [[ "$git_url" =~ ^git@ ]]; then
# SSH URL (e.g., [email protected]:user/repo.git)
web_url=$(sed -E 's/^git@([^:]+):/https:\/\/\1\//;s/\.git$//' <<<"$git_url")
web_url=$(sed -E "s|^git@([^:]+):|https:\/\/\1\/|;s|\.git$||" <<<"$git_url")
elif [[ "$git_url" =~ ^git:// ]]; then
# Git protocol URL (e.g., git://github.com/user/repo.git)
web_url=$(sed -E 's/^git:\/\//https:\/\//;s/\.git$//' <<<"$git_url")
web_url=$(sed -E "s|^git:\/\/|https:\/\/|;s|\.git$||" <<<"$git_url")
elif [[ "$git_url" =~ ^ssh:// ]]; then
# SSH URL (e.g., ssh://[email protected]/user/repo.git)
web_url=$(sed -E 's/^ssh:\/\/git@([^/]+)\//https:\/\/\1\//;s/\.git$//' <<<"$git_url")
web_url=$(sed -E "s|^ssh:\/\/git@([^/]+)\/|https:\/\/\1\/|;s|\.git$||" <<<"$git_url")
else
return 1
fi
Expand Down
2 changes: 1 addition & 1 deletion Rename files/Remove brackets
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _main_task() {

# Remove brackets.
# shellcheck disable=SC2001
output_file=$(sed 's/ *([^)]*)//g' <<<"$filename")
output_file=$(sed "s| *([^)]*)||g" <<<"$filename")

# Run the main process.
_move_file "skip" "$input_file" "$dir/$output_file" || return 1
Expand Down

0 comments on commit 2f7ad26

Please sign in to comment.