From 0f11caf14e67d60b1bab600b50e40ed0f7f5fcbd Mon Sep 17 00:00:00 2001 From: anon Date: Sun, 24 Sep 2023 20:44:31 +0200 Subject: [PATCH] alignment fixes --- qckcmd | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/qckcmd b/qckcmd index 01b6129..f09b204 100755 --- a/qckcmd +++ b/qckcmd @@ -22,17 +22,17 @@ exec 1>&2 function usage(){ echo -e "${BOLD}${SCRIPT_NAME} [options]${NORMAL}" - echo -e " -h : print this help message" - echo -e " -i [file] : specify init file" + echo -e "\t-h : print this help message" + echo -e "\t-i [file] : specify init file" echo -e "${YELLOW}Qckcmd allows you to map keys to commands.${NORMAL}" echo -e "${YELLOW}Effectively it's a hack to compensate for the in unreliableness of what key combinations are trapped by terminal emulators/multiplexers by adding a prefix key.${NORMAL}" echo -e "${YELLOW}Qckcmd does not directly execute commands, if one is successfully selected it will be echod to stdout.${NORMAL}" echo -e "${YELLOW}Nothing else will ever be printed on stdout.${NORMAL}" echo -e "${YELLOW}The intended way to run is to execute it's output like so:${NORMAL}" - echo -e "${BLUE} \$(qckcmd -i myinit.conf)${NORMAL}" + echo -e "${BLUE}\t\$(qckcmd -i myinit.conf)${NORMAL}" echo -e "${YELLOW}As a result commands modifying the shells internal state are valid to map to (e.g.: cd, source, ).${NORMAL}" echo -e "${YELLOW}The configuration follows this format:${NORMAL}" - echo -e "${BLUE} : ${NORMAL}" + echo -e "${BLUE}\t: ${NORMAL}" } function list_options() { @@ -52,29 +52,29 @@ function read_config() { OPTSTR="hi:" while getopts "${OPTSTR}" O; do - case $O in - h) usage && exit ;; - i) read_config ${OPTARG} ;; - *) echo -e "${RED}Unrecognized option, exiting...${NORMAL}" && exit 1 ;; - esac + case $O in + h) usage && exit ;; + i) read_config ${OPTARG} ;; + *) echo -e "${RED}Unrecognized option, exiting...${NORMAL}" && exit 1 ;; + esac done while true; do list_options printf "${RED}> ${NORMAL}" - read -n 1 INPUT + read -n 1 INPUT echo "" INPUT="${INPUT#"${INPUT%%[![:space:]]*}"}" if [[ -z "$INPUT" ]]; then continue - fi + fi - if [[ -n "${POINTS[$INPUT]}" ]]; then + if [[ -n "${POINTS[$INPUT]}" ]]; then echo -e "${BOLD}$ ${POINTS[$INPUT]}${NORMAL}" exec 1>&3 - echo "${POINTS[$INPUT]}" + echo "${POINTS[$INPUT]}" exit 0 - fi + fi done