Skip to content

Commit 0e7dab8

Browse files
committed
Formatting schellmenu.sh
1 parent 3d8fa8c commit 0e7dab8

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

shellmenu.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ waitonexit=true
99
continuemenu=true
1010
globalClmWidth=45
1111
immediateMode=false
12+
actualmenu="EasyKey.shellmenu"
1213

1314
############################
1415
############################
@@ -291,8 +292,11 @@ selectFromCsv() {
291292
linefrom=${linefrom:=2}
292293
lineto=${lineto:=80}
293294
coloredLog "${csvfile}" '1;37;44'
294-
headers=$(head -1 "$csvfile" | sed 's/ /_/g' | awk -F, 'BEGIN {i=1} {while (i<=NF) {str=str substr($i,1,12)","; i++;}} END {print str}')
295-
selectItem '(echo "${headers}" && sed -n '"${linefrom}"','"${lineto}"'p "${csvfile}") | perl -pe "s/((?<=,)|(?<=^)),/ ,/g;" | column -t -s, | less -S' '.*' 192 1 "$preselection" "$xdarkprocessing"
295+
headers=$(head -1 "$csvfile" | sed 's/ /_/g' \
296+
| awk -F, 'BEGIN {i=1} {while (i<=NF) {str=str substr($i,1,12)","; i++;}} END {print str}')
297+
selectItem '(echo "${headers}" && sed -n '"${linefrom}"','"${lineto}"'p "${csvfile}") \
298+
| perl -pe "s/((?<=,)|(?<=^)),/ ,/g;" \
299+
| column -t -s, | less -S' '.*' 192 1 "$preselection" "$xdarkprocessing"
296300
}
297301

298302
#################################################
@@ -318,9 +322,18 @@ coloredCsvTable() { #show csv file with header line in nice format
318322
coloredLog "${csvfile}" '1;37;44'
319323
! [ "${heading}" = "" ] && coloredLog "${heading}"
320324
if [ "${width}" = "" ]; then
321-
(echo "${headers}" && sed -n "${linefromXX},${linetoXX}p" "${csvfile}") | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, | less -S | alternateRows 1
325+
(echo "${headers}" && sed -n "${linefromXX},${linetoXX}p" "${csvfile}") \
326+
| perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' \
327+
| column -t -s, \
328+
| less -S \
329+
| alternateRows 1
322330
else
323-
(echo "${headers}" && sed -n "${linefromXX},${linetoXX}p" "${csvfile}") | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, | less -S | awk -v m=${width} '{printf("[%-'${width}'s]\n", $0)}' | alternateRows 1
331+
(echo "${headers}" && sed -n "${linefromXX},${linetoXX}p" "${csvfile}") \
332+
| perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' \
333+
| column -t -s, \
334+
| less -S \
335+
| awk -v m=${width} '{printf("[%-'${width}'s]\n", $0)}' \
336+
| alternateRows 1
324337
fi
325338
}
326339

0 commit comments

Comments
 (0)