summarylogtreecommitdiffstats
path: root/fakeAUR.sh
blob: 823db204df06c16ab389116369fad037c4c85569 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash -i
#Developer: schrmh (schreibemirhalt@gmail.com) / derberg#7221 from Linux Gaming Discord
#Version: 2 - now with impossible piping
function show_help () {
    echo "fakeAUR 2 - now with impossible piping"
    echo "You pipe with your package helper (e.g yay) and provide a new package name and a new description:"
    echo "yay <package> | fakeAUR nani \"now you can speak japanese\""
    echo ""
    echo "use -btw without further parameters for a btwiusearch message or -nani for that nani message."
    echo "-grep will grep the original description of the piped package"
    echo "TODO: 1). switch between core/community/aur or custom with colour. Also version, size, orphanded, etc."
    echo "2) Manipulate multiple packages at once and list them just like a package helper would"
    echo "3) Copy a screnshoot to clipboard"
    echo "4) Fix formatted output for trizen.."
    echo "5) A config file that allows custom shortcuts that are like -btw or -nani"
    echo "Try -debug if something is wrong with the output"
}
if [ $# -eq 0 ] 
then
    show_help
    exit 1
fi

for i in "$@"
    do 
        case $i in
            -h | --h | --help )
                show_help
                exit 1
            ;;
            -debug )
                processes=$(> >(ps -f))
                echo $processes
                echo "and now reduced"
                pac=$(echo $processes | grep -o -P "(?<=00:00:00).*(?=$USER)" | grep -o -P "(?<=00:00:00).*(?=00:00:00)")
                echo $pac
                helper=$(echo $pac | cut -d' ' -f1)
                two=$(echo $pac | cut -d' ' -f2)
                pac=$helper" "$two
                echo concat
                echo $pac
                echo concat end
                
               # if [[ $pac = *"00"* ]]; then
               #     delete=$(echo $pac | grep -oP "(?<=$USER\s)\w+")
               #     pac=$(echo $pac | grep -o -P '(?<=00:00:00).*(?=)')
               #     echo lol
               #     echo $pac
               #     echo rid off me
               #     echo $delete
               #     echo now
               #     kill -9 $delete
               # fi
               # echo $pac
            
                description=$(echo -ne '\n' | eval "${pac}" | grep "    ")
                name=$(echo ${pac} | grep -Eo "[^ ]+$")
                echo ${PS1@P}$helper btwiusearch
                echo -ne '\n' | eval ${pac} | sed -e "s/$name/btwiusearch/" | sed -e "s/$description/A very important and easy to use package to show the world that you run the best distro/"
            ;;
            -btw )
                processes=$(> >(ps -f))
                pac=$(echo $processes | grep -o -P "(?<=00:00:00).*(?=$USER)" | grep -o -P "(?<=00:00:00).*(?=00:00:00)")
                helper=$(echo $pac | cut -d' ' -f1)
                two=$(echo $pac | cut -d' ' -f2)
                pac=$helper" "$two
            
                description=$(echo -ne '\n' | eval "${pac}" | grep "    ")
                name=$(echo ${pac} | grep -Eo "[^ ]+$")
                echo ${PS1@P}$helper btwiusearch
                echo -ne '\n' | eval ${pac} | sed -e "s/$name/btwiusearch/" | sed -e "s/$description/A very important and easy to use package to show the world that you run the best distro/"
            ;;
            -nani )
                processes=$(> >(ps -f))
                pac=$(echo $processes | grep -o -P "(?<=00:00:00).*(?=$USER)" | grep -o -P "(?<=00:00:00).*(?=00:00:00)")
                helper=$(echo $pac | cut -d' ' -f1)
                two=$(echo $pac | cut -d' ' -f2)
                pac=$helper" "$two
            
                description=$(echo -ne '\n' | eval "${pac}" | grep "    ")
                name=$(echo ${pac} | grep -Eo "[^ ]+$")
                echo ${PS1@P}$helper nani
                echo -ne '\n' | eval ${pac} | sed -e "s/$name/nani/" | sed -e "s/$description/now you can speak japanese/"
            ;;
            -grep)
                processes=$(> >(ps -f))
                pac=$(echo $processes | grep -o -P "(?<=00:00:00).*(?=$USER)" | grep -o -P "(?<=00:00:00).*(?=00:00:00)")
                helper=$(echo $pac | cut -d' ' -f1)
                two=$(echo $pac | cut -d' ' -f2)
                pac=$helper" "$two
            
                description=$(echo -ne '\n' | eval "${pac}" | grep "    ")
                echo $description
            ;;
            *)
                processes=$(> >(ps -f))
                pac=$(echo $processes | grep -o -P "(?<=00:00:00).*(?=$USER)" | grep -o -P "(?<=00:00:00).*(?=00:00:00)")
                helper=$(echo $pac | cut -d' ' -f1)
                two=$(echo $pac | cut -d' ' -f2)
                pac=$helper" "$two
            
                description=$(echo -ne '\n' | eval "${pac}" | grep "    ")
                name=$(echo ${pac} | grep -Eo "[^ ]+$")
                echo ${PS1@P}$helper $1
                echo -ne '\n' | eval ${pac} | sed -e "s/$name/$1/" | sed -e "s/$description/$2/"
            ;;
        esac
    done
exit 0