op: only display directories that has a git repo in it

This commit is contained in:
Pratik Tripathy
2024-03-13 22:20:33 +05:30
parent 833a1ee1b1
commit cc39aa298d

View File

@@ -3,7 +3,6 @@
# TODO: # TODO:
# - Create fuzzy finder for cht.sh & tldr + system man pages + learnxinyminutes github # - Create fuzzy finder for cht.sh & tldr + system man pages + learnxinyminutes github
# Quick open project files in NVIM # Quick open project files in NVIM
op() { op() {
if ! command -v fzf >/dev/null; then if ! command -v fzf >/dev/null; then
@@ -14,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 2 -maxdepth 2 -not -path '*/.*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | fzf --prompt='Select a project: ')" project_dir="$(find -L ~/Code -mindepth 1 -maxdepth 5 -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