home
/
code
/
khome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
834da58
)
Format p
author
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 20 Apr 2023 19:47:17 +0000
(15:47 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 20 Apr 2023 19:47:17 +0000
(15:47 -0400)
home/bin/p
patch
|
blob
|
blame
|
history
diff --git
a/home/bin/p
b/home/bin/p
index
b4a9cab
..
507d578
100755
(executable)
--- a/
home/bin/p
+++ b/
home/bin/p
@@
-47,18
+47,22
@@
main() {
local name file records i meta data datum
case "$#" in
local name file records i meta data datum
case "$#" in
- 0)
- echo "$usage" >&2
- return 1;;
- 1)
- file="$default_file"
- name="$1";;
- 2)
- file="$1"
- name="$2";;
- *)
- echo "$usage" >&2
- return 1;;
+ 0)
+ echo "$usage" >&2
+ return 1
+ ;;
+ 1)
+ file="$default_file"
+ name="$1"
+ ;;
+ 2)
+ file="$1"
+ name="$2"
+ ;;
+ *)
+ echo "$usage" >&2
+ return 1
+ ;;
esac
records=$(find "$name" "$file")
esac
records=$(find "$name" "$file")
@@
-67,14
+71,17
@@
main() {
# XXX Even an empty result will count as one line after echo, so need to filter:
case "$(echo "$records" | grep -vc '^$')" in
# XXX Even an empty result will count as one line after echo, so need to filter:
case "$(echo "$records" | grep -vc '^$')" in
- 0)
- echo '[ERROR] Found nothing.' >&2
- exit 1;;
- 1)
- datum="$data";;
- *)
- i=$(echo "$meta" | column -t | fzf | awk '{print $1}')
- datum=$(echo "$data" | awk -v i="$i" 'NR == i');;
+ 0)
+ echo '[ERROR] Found nothing.' >&2
+ exit 1
+ ;;
+ 1)
+ datum="$data"
+ ;;
+ *)
+ i=$(echo "$meta" | column -t | fzf | awk '{print $1}')
+ datum=$(echo "$data" | awk -v i="$i" 'NR == i')
+ ;;
esac
# XXX Intentionally avoiding newline:
esac
# XXX Intentionally avoiding newline:
This page took
0.021857 seconds
and
4
git commands to generate.