fix: Fix project quick open scripts
- Existing projects: search 4 directory deep for `.git` - New projects: ensure project opens in neovim after it completes download
This commit is contained in:
@@ -13,7 +13,7 @@ op() {
|
|||||||
# %T => Sort by last modified
|
# %T => Sort by last modified
|
||||||
# @ => time displayed in seconds (since 1.1.1970)
|
# @ => time displayed in seconds (since 1.1.1970)
|
||||||
# %p => Directory path
|
# %p => Directory path
|
||||||
project_dir="$(find -L ~/Code -mindepth 1 -maxdepth 3 -name ".git" -not -path '*/.stversions/*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | xargs dirname | fzf --prompt='Select a project: ')"
|
project_dir="$(find -L ~/Code -mindepth 1 -maxdepth 4 -name ".git" -not -path '*/.stversions/*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | xargs dirname | fzf --prompt='Select a project: ')"
|
||||||
|
|
||||||
# Do nothing and return if user cancelled out
|
# Do nothing and return if user cancelled out
|
||||||
if [ "$project_dir" = "" ]; then
|
if [ "$project_dir" = "" ]; then
|
||||||
@@ -50,7 +50,7 @@ pnew() {
|
|||||||
printf "Git repo URL: "
|
printf "Git repo URL: "
|
||||||
read -r git_url
|
read -r git_url
|
||||||
cd "$directory" || return 126
|
cd "$directory" || return 126
|
||||||
git clone "$git_url" || cd - >/dev/null && return
|
git clone "$git_url" || return
|
||||||
cd "$(basename "$git_url" | cut -d '.' -f 1)" || return 126
|
cd "$(basename "$git_url" | cut -d '.' -f 1)" || return 126
|
||||||
else
|
else
|
||||||
# Loop until user provides a valid directory name or cancels out
|
# Loop until user provides a valid directory name or cancels out
|
||||||
|
|||||||
Reference in New Issue
Block a user