dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 926052ffa78aef7db4109e17880f2472711ae25a
parent a79fdf5411ccf8072b8df79e06915854a47bcf88
Author: Chris Noxz <chris@noxz.tech>
Date:   Sat, 28 Mar 2020 16:57:23 +0100

[bin] remove obsolete script

Diffstat:
Dbin/.local/bin/contacts | 72------------------------------------------------------------------------
1 file changed, 0 insertions(+), 72 deletions(-)

diff --git a/bin/.local/bin/contacts b/bin/.local/bin/contacts @@ -1,72 +0,0 @@ -#!/bin/sh - -[ "$1" = "" ] && exit - -get_header_index() { - echo "$1" \ - | grep "^[0-9]*:$2$" \ - | sed "s/:.*$//" -} - -# download data -data="$(curl \ - --silent "https://mail.noxz.tech/SOGo/so/$1/Contacts/personal/view" \ - --header "Accept: application/json" \ - --header "Content-Type: application/json" \ - --user "$(printf '%s:%s' "$1" "$(pass "/mail/$1/password")")" \ -)" - -# download headers (first row contains header names) -headers="$(echo "$data" \ - | jq '.headers | .[0]' \ - | grep '^ ' \ - | sed -e 's/"[,]*$//' -e 's/^ "//' \ - | awk '{print NR-1 ":" $0}' \ -)" - -# get header indices -h1="$(get_header_index "$headers" 'c_givenname')" -h2="$(get_header_index "$headers" 'c_sn')" -h3="$(get_header_index "$headers" 'c_cn')" -h4="$(get_header_index "$headers" 'c_mail')" - -# parse data -i=0 -alias="" -while true; do - i="$((i+1))" - row="$(echo "$data" \ - | jq ".headers | .[$i]" \ - )" - - # break on fail or null return - [ "$?" -ne 0 ] || [ "$row" = "null" ] && break - - alias="$alias$(echo "$row" \ - | jq -r ".|.[$h1],.[$h2],.[$h3],.[$h4]" \ - | tr '\n' ':')\n" -done - -# print generation string -printf "# this file was generated using: %s %s\n" "$0" "$@" - -# print aliases -echo "$alias" \ - | sort -t ':' -k 2,2 -k 1,1 \ - | awk "$(cat <<'EOT' - BEGIN { - FS=OFS=SUBSEP=":" - printf("unalias *\n") - } - $4 != "" { - arr[$2] = sprintf("%s,%.3s%.3s", arr[$2], $1, $2) - printf("alias %.3s%.3s %s (%s)\n", tolower($1), tolower($2), $4, $3) - } - END { - printf("\n") - for (x in arr) { - printf("alias %s %s\n", tolower(x), tolower(substr(arr[x], 2))) - } - } -EOT -)"