about summary refs log tree commit diff stats
path: root/home-manager/packages/scripts/apps/deprecated/riR/lf-move-fill(has_been_riR)
blob: 8071dfa7113c2fca8c4612f681da331b73ffea6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
. %SHELL_LIBRARY_PATH

tmp=$(mktemp);
out=$(mktemp);
clean $XDG_CONFIG_HOME/lf/rel_dirs > $tmp;

get_hot_key() {
    printf g
    if ! [ "$i" = "$(readlink -f "$(cat $tmp | sed -n -e ${a}p)")" ];then 
        printf "%s" "$(basename "$(cat $tmp | sed -n -e ${a}p)" | cut -c 1)"; # i.e. /home/dt/school
    fi
    #if ! [ "$(realpath i)" = "$(cat $tmp | sed -n -e ${a}p)" ];then
    # i = /home/dt/school/informatik
        printf "%s" "$(basename $i | cut -c 1)";
        printf "%s" "$(basename $i | cut -c 2)";
    #fi
    if [ $i = "$(cat $tmp | sed -n -e ${1}p)" ];then
        printf '.';
    fi

}


for a in $(seq "$(cat $tmp | wc -l )");do
    echo $a >> $out;

    while IFS= read -r i;do
        printf "map %s cd %s\n" "$(get_hot_key "$a")" "$i" >> $out;
    done < "$(tmp find "$(cat $tmp | sed -n -e ${a}p)" -maxdepth 1)"
    echo >> $out;
done

cat $out # | awk '{print $2}' | sort | uniq -d;

rm $tmp;
rm $out;
if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi