diff options
author | schrmh | 2018-09-18 05:25:49 +0200 |
---|---|---|
committer | schrmh | 2018-09-18 05:25:49 +0200 |
commit | 2dc7e5ba59357bb919e776c75eadaa079d6f9c27 (patch) | |
tree | 9022f2b99ed9a1606a54ad358f2115a4843a9238 /fakeAUR.sh | |
parent | 551428f3f01d0885037d0356ddb4239ea4751117 (diff) | |
download | aur-2dc7e5ba59357bb919e776c75eadaa079d6f9c27.tar.gz |
Piping is now possible
Diffstat (limited to 'fakeAUR.sh')
-rwxr-xr-x | fakeAUR.sh | 87 |
1 files changed, 63 insertions, 24 deletions
diff --git a/fakeAUR.sh b/fakeAUR.sh index 06ec29925f8a..b58174b0dbc0 100755 --- a/fakeAUR.sh +++ b/fakeAUR.sh @@ -1,18 +1,18 @@ #!/bin/bash -i #Developer: schrmh (schreibemirhalt@gmail.com) / derberg#7221 from Linux Gaming Discord -#Git-Repo: +#Version: 2 - now with impossible piping function show_help () { - echo "fakeAUR" - echo "You need to use the option -echo and provide AUR helper (e.g. yay) + old name package name, new package name and new description:" - echo "fakeAUR -echo \"yay fakeAUR\" nani \"now you can speak japanese\"" + 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 for a btwiusearch message and -nani for that nani message." + 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) implement piping: yay fakeAUR | fakeAUR nani \"now you can speak japanese\"" - echo "5) Fix formatted output for trizen.." + echo "4) Fix formatted output for trizen.." + echo "5) A config file that allows custom shortcuts that are like -btw or -nani" } if [ $# -eq 0 ] then @@ -28,29 +28,68 @@ for i in "$@" exit 1 ;; -btw ) - description=$(echo -ne '\n' | eval "$2" | grep " ") - name=$(echo $2 | grep -Eo "[^ ]+$") - helper=$(echo $2 | grep -o '^\S*') + processes=$(> >(ps -f)) + pac=$(echo $processes | grep -o -P '(?<=CM).*(?=fakeAUR)' | grep -o -P '(?<=D).*(?=fakeAUR)' | grep -o -P "(?<=00:00:00).*(?=$USER)") + #echo $pac + 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:1}" | grep " ") + name=$(echo ${pac:1} | grep -Eo "[^ ]+$") + helper=$(echo ${pac:1} | grep -o '^\S*') echo ${PS1@P}$helper btwiusearch - echo -ne '\n' | eval $2 | 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/" + echo -ne '\n' | eval ${pac:1} | 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 ) - description=$(echo -ne '\n' | eval "$2" | grep " ") - name=$(echo $2 | grep -Eo "[^ ]+$") - helper=$(echo $2 | grep -o '^\S*') + processes=$(> >(ps -f)) + pac=$(echo $processes | grep -o -P '(?<=CM).*(?=fakeAUR)' | grep -o -P '(?<=D).*(?=fakeAUR)' | grep -o -P "(?<=00:00:00).*(?=$USER)") + if [[ $pac = *"00"* ]]; then + delete=$(echo $pac | grep -oP "(?<=$USER\s)\w+") + pac=$(echo $pac | grep -o -P '(?<=00:00:00).*(?=)') + kill -9 $delete + fi + + description=$(echo -ne '\n' | eval "${pac:1}" | grep " ") + name=$(echo ${pac:1} | grep -Eo "[^ ]+$") + helper=$(echo ${pac:1} | grep -o '^\S*') echo ${PS1@P}$helper nani - echo -ne '\n' | eval $2 | sed -e "s/$name/nani/" | sed -e "s/$description/now you can speak japanese/" - ;; - -echo ) - description=$(echo -ne '\n' | eval "$2" | grep " ") - name=$(echo $2 | grep -Eo "[^ ]+$") - helper=$(echo $2 | grep -o '^\S*') - echo ${PS1@P}$helper $3 - echo -ne '\n' | eval $2 | sed -e "s/$name/$3/" | sed -e "s/$description/$4/" + echo -ne '\n' | eval ${pac:1} | sed -e "s/$name/nani/" | sed -e "s/$description/now you can speak japanese/" ;; -grep) - description=$(echo -ne '\n' | eval "$2" | grep " ") - echo $description + processes=$(> >(ps -f)) + pac=$(echo $processes | grep -o -P '(?<=CM).*(?=fakeAUR)' | grep -o -P '(?<=D).*(?=fakeAUR)' | grep -o -P "(?<=00:00:00).*(?=$USER)") + if [[ $pac = *"00"* ]]; then + delete=$(echo $pac | grep -oP "(?<=$USER\s)\w+") + pac=$(echo $pac | grep -o -P '(?<=00:00:00).*(?=)') + kill -9 $delete + fi + + description=$(echo -ne '\n' | eval "${pac:1}" | grep " ") + echo $description + ;; + *) + processes=$(> >(ps -f)) + pac=$(echo $processes | grep -o -P '(?<=CM).*(?=fakeAUR)' | grep -o -P '(?<=D).*(?=fakeAUR)' | grep -o -P "(?<=00:00:00).*(?=$USER)") + if [[ $pac = *"00"* ]]; then + delete=$(echo $pac | grep -oP "(?<=$USER\s)\w+") + pac=$(echo $pac | grep -o -P '(?<=00:00:00).*(?=)') + kill -9 $delete + fi + + description=$(echo -ne '\n' | eval "${pac:1}" | grep " ") + name=$(echo ${pac:1} | grep -Eo "[^ ]+$") + helper=$(echo ${pac:1} | grep -o '^\S*') + echo ${PS1@P}$helper $1 + echo -ne '\n' | eval ${pac:1} | sed -e "s/$name/$1/" | sed -e "s/$description/$2/" ;; esac done |