dot

packages and services management
Log | Files | Refs | README

commit 69f71252581652367e6c2982aeda0533f79dc821
parent 090c89dbda0b60b0a1bd5c2739e57ed91c580d9c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 27 Dec 2017 21:54:48 +0100

fixing sorting

Diffstat:
Abin/ll | 3+++
Abin/lr | 15+++++++++++++++
Abin/lt | 42++++++++++++++++++++++++++++++++++++++++++
Mbin/term-inv | 2+-
Mdot/config/wpa_supplicant | 2+-
5 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/bin/ll b/bin/ll @@ -0,0 +1,3 @@ +#!/bin/sh + +lr "${@:-.}" -maxdepth 1 diff --git a/bin/lr b/bin/lr @@ -0,0 +1,15 @@ +#!/bin/sh +# list recursively with some stat infos + +LC_COLLATE=C + +e=$(printf '\033') +t=$(printf '\t') + +find "${@:-.}" -exec stat -f '%Sp %10z%t%N/' {} + -o \ + -name .git -prune -o -name CVS -o -prune | sort -u -t ' ' -k 2 | +sed -r " + s|/*$|| + /^d/ s/$t(.*)/$t$e\[1;34m\1$e\[m/ + /^l/ s/$t(.*)/$t$e\[1;36m\1$e\[m/ +" diff --git a/bin/lt b/bin/lt @@ -0,0 +1,42 @@ +#!/bin/sh +# list paths in a tree with some stat infos + +LC_COLLATE=C + +case $# in (0) ;; (1) cd "$1" || exit 1 ;; (*) exit 1 ;; esac + +find . -name CVS -prune -o -name .git -prune -o \ + -exec stat -f '%Sp %11z%t%N/' {} + | sort -u -t ' ' -k 2 | +awk -v LINE='| ' -v NODE='|- ' -v TAIL='`- ' -v VOID=' ' ' + +{ + count = split($0, path_v, "/") - 1; + for (i = 2; i <= count; i++) + line_v[NR":"i] = LINE; + sub("\t.*", "", $0); + line_v[NR":"i - 1] = NODE; + line_v[NR":"1] = $0 "\t" + line_v[NR"name"] = substr(path_v[count], index(path_v[count], "\t") + 1); +} + +END { + for (i = 2; !stop; i++) { + stop = tail = 1; + for (l = NR; l > 0; l--) { + if (line_v[l":"i] == LINE && tail) { + line_v[l":"i] = VOID; + stop = 0; + } else if (line_v[l":"i] == NODE && tail) { + line_v[l":"i] = TAIL; + tail = stop = 0; + } else if (!line_v[l":"i]) { + tail = 1; + } + } + } + for (l = 1; l <= NR; l++) { + for (i = 1; line_v[l":"i] != ""; i++) + printf("%s", line_v[l":"i]); + printf("%s\n", line_v[l"name"]); + } +}' diff --git a/bin/term-inv b/bin/term-inv @@ -1,3 +1,3 @@ #!/bin/sh -[ $# = 1 ] && printf '\033[?5%s' h || printf '\033[?5%s' l +[ $# = 0 ] && printf '\033[?5%s' h || printf '\033[?5%s' l diff --git a/dot/config/wpa_supplicant b/dot/config/wpa_supplicant @@ -25,5 +25,5 @@ ctrl_interface_group=wheel network={ ssid="SFR_2016" - psk=a3f63bd8aa82889867d0f5ee821b3ec5213d78ce6d4d529dd03368ab302290ad + #psk="XXX" }