From 865728068c965e066d0f8971c5b5ba26e12e7dce Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 24 Dec 2020 00:06:27 +0530 Subject: Adds scripts and links scripts and wallpapers --- scripts/bin/macho | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/bin/macho (limited to 'scripts/bin/macho') diff --git a/scripts/bin/macho b/scripts/bin/macho new file mode 100755 index 0000000..93b8f8f --- /dev/null +++ b/scripts/bin/macho @@ -0,0 +1,26 @@ +#!/bin/sh + +export FZF_DEFAULT_OPTS=' +--height=30% +--layout=reverse +--prompt="Manual: " +--preview="echo {1} | sed -E \"s/^\((.+)\)/\1/\" | xargs -I{S} man -Pcat {S} {2} 2>/dev/null"'; + +while getopts ":s:" opt; do + case $opt in + s ) SECTION=$OPTARG; shift; shift;; + \?) echo "Invalid option: -$OPTARG" >&2; exit 1;; + : ) echo "Option -$OPTARG requires an argument" >&2; exit 1;; + esac; +done; + +manual=$(apropos -s ${SECTION:-''} ${@:-.} | \ + grep -v -E '^.+ \(0\)' |\ + awk '{print $2 " " $1}' | \ + sort | \ + fzf | \ + sed -E 's/^\((.+)\)/\1/'); + +[ -z "$manual" ] && exit 0; +man $manual; + -- cgit v1.3.1