This repository was archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyups-query
executable file
·145 lines (137 loc) · 3.54 KB
/
yups-query
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# ------------------------------------------------------------------
# This script is part of yups
# Created: 2021-10-19, version 0.0.1
# Copysomething (C?) 2021 Niklas Adam
# Email: [email protected]
# URL: https://niklasadam.oddodd.org
# ------------------------------------------------------------------
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# ------------------------------------------------------------------
version=1.0.0
usage="usage: yups-query -sm {args}"
margin=2,3 # default margin
while getopts s:m: option; do
case "${option}" in
s | style)
style=${OPTARG}
;;
m | margin)
margin=${OPTARG}
;;
*)
echo $usage
exit 0
;;
esac
done
default_colors() {
header=#666666
bg=#1c1c1c
bgp=#202020
fg=#e9e9e9
fgp=#bbbbbb
previewbg=#1c1c1c
previewfg=#e9e9e9
info=#cbcbcb
border=#555555
spinner=#666666
hl=#555555
hlp=#666666
pointer=#444444
prompt=#555555
gutter=#323232
marker=#666666
}
light_colors() {
header=#fe5009
bg=#ebdbb2
bgp=#d5c4a1
fg=#000000
fgp=#504945
previewbg=#8ec07c
previewfg=#000000
info=#665c54
border=#d3869b
spinner=#fe8019
hl=#1102aa
hlp=#1102fb
pointer=#fe5009
prompt=#b8bb26
gutter=#8ec07c
marker=#1f92fb
}
mono_colors() {
header=#a1efe4
bg=#272822
bgp=#223aa2
fg=#a6e22e
fgp=#f91992
previewbg=#125849
previewfg=#fc6633
info=#f5f4f1
border=#a1efe4
spinner=#f4bf75
hl=#66d9ef
hlp=#66d9af
pointer=#ae81ff
prompt=#f8a8f2
gutter=#383830
marker=#fc6633
}
paper_colors() {
header=#d7875f
bg=#1c1c1c
bgp=#5f8787
fg=#5fafd7
fgp=#1ae00f
previewbg=#585858
previewfg=#ffaf00
info=#afd700
border=#af005f
spinner=#00afaf
hl=#d7af5f
hlp=#fa09d0
pointer=#af005f
prompt=#808080
gutter=#4c8787
marker=#af005f
}
# set colors
case $style in
light | l)
light_colors
;;
mono | m)
mono_colors
;;
paper | p)
paper_colors
;;
*)
default_colors
;;
esac
paru -Qq | fzf --preview 'paru -Qil {1}' --reverse --margin $margin% \
--header=$'╔════════════════════╗\n║░ yups-query ░║\n╚════════════════════╝\
installed packages:\n\n' \
--pointer='▓' --prompt='' --border=sharp \
--bind 'ctrl-w:toggle-preview-wrap' \
--bind 'ctrl-p:toggle-preview' \
--bind 'ctrl-l:clear-query' \
--bind 'shift-right:preview-page-down' \
--bind 'shift-left:preview-page-up' \
--bind 'enter:abort' \
--color='bg:'$bg,'bg+:'$bgp,'info:'$info,'border:'$border,'spinner:'$spinner \
--color='hl:'$hl,'fg:'$fg,'fg+:'$fgp,'pointer:'$pointer,'prompt:'$prompt,'header:'$header \
--color='hl+:'$hlp,'marker:'$marker,'preview-bg:'$previewbg,'preview-fg:'$previewfg