scripts

Scripts for general automations
git clone git://git.laack.co/scripts.git
Log | Files | Refs

abduco.sh (1017B)


      1 #!/bin/bash
      2 
      3 if [ -n "$1" ]; then
      4     prompt="abduco dir:"
      5 
      6     # exclude git repos which have lots of sub-dirs,
      7     # .cache which has a ton of firefox crap
      8     # .local because I never really go there and lots
      9     # of crap there too, and finally .firefox.
     10 
     11     directory=$(find ~ -type d \
     12       ! -path '*/.local/*' \
     13       ! -path '*/.cache/*' \
     14       ! -path '*/.firefox/*' \
     15       ! -path '*/.mozilla/*' \
     16       ! -path '*/.git/*' \
     17       | dmenu -l -p "$prompt")
     18 
     19     # Check if a directory was selected
     20     if [ -z "$directory" ]; then
     21         echo "No directory selected."
     22         exit 1
     23     fi
     24 
     25     # Check if the directory exists
     26     if [ ! -d "$directory" ]; then
     27         echo "Directory not found!"
     28         exit 1
     29     fi
     30 
     31     cd $directory
     32 
     33     # directory name w/o full path
     34     dirWO=$(echo $directory | sed "s/\// /g"| cut -c 2- | awk '{print $NF}')
     35     st -e abduco -A "$dirWO"
     36 else
     37     SELECTION=$(abduco | tr '*' ' ' | awk '{print $5}' | tail -n+2 | fzf --print-query)
     38     abduco -A $SELECTION
     39 fi