From 9d91448c3a4bf3572e12c557a4d0deab8a53499e Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sun, 5 Jul 2020 11:53:12 +0000 Subject: [PATCH] removes ineffective bash completion. simplifies install --- Makefile | 21 --------------------- README.md | 22 ++++++++++++++-------- pb | 16 ++-------------- pb.1 | 2 +- pb.d | 28 ---------------------------- 5 files changed, 17 insertions(+), 72 deletions(-) delete mode 100644 pb.d diff --git a/Makefile b/Makefile index 4094123..a94100a 100644 --- a/Makefile +++ b/Makefile @@ -12,21 +12,6 @@ INSTALL_DATA=$(INSTALL) -Dm 644 bindir=$(DESTDIR)$(PREFIX)/bin sharedir=$(DESTDIR)$(PREFIX)/share -# Attempt to find bash completion dir in order of preference -ifneq ($(wildcard /etc/bash_completion.d/.),) - cpldir ?= /etc/bash_completion.d -endif - -HAS_BREW := $(shell command -v brew 2> /dev/null) -ifdef HAS_BREW - cpldir ?= $$(brew --prefix)/etc/bash_completion.d -endif - -HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null) -ifdef HAS_PKGCONFIG - cpldir ?= $$(pkg-config --variable=completionsdir bash-completion 2> /dev/null) -endif - help: @echo "targets:" @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -36,15 +21,9 @@ help: install: pb pb.1 ## system install $(INSTALL_PROGRAM) pb $(bindir)/pb $(INSTALL_DATA) pb.1 $(sharedir)/man/man1/pb.1 -ifdef cpldir - $(INSTALL_DATA) pb.d $(cpldir)/pb -endif uninstall: ## system uninstall rm -f $(bindir)/pb rm -f $(sharedir)/man/man1/pb.1 -ifdef cpldir - rm -f $(cpldir)/pb -endif .PHONY: install uninstall help diff --git a/README.md b/README.md index 0e100a9..f90384a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -pb ![calver](https://img.shields.io/badge/calver-2020.06.10-22bfda.svg?style=flat-square) ![status](https://img.shields.io/badge/status-working-green.svg?style=flat-square) ![license](https://img.shields.io/badge/license-GPL3-blue.svg?style=flat-square) +pb ![calver](https://img.shields.io/badge/calver-2020.07.05-22bfda.svg?style=flat-square) ![status](https://img.shields.io/badge/status-working-green.svg?style=flat-square) ![license](https://img.shields.io/badge/license-GPL3-blue.svg?style=flat-square) ------ **pb** is a helper utility for using 0x0 pastebin services @@ -54,21 +54,27 @@ pb -u https://google.com On GNU systems: -`sudo make install` - -_Note: On systems without admin access the binary can be run directly from the -git repo, but will lack `man` support and command completion._ +```sh +sudo make install +``` On BSD systems: ```sh -install 755 pb /usr/local/bin -install 644 pb /usr/local/man/man1 +doas gmake install ``` ### Uninstall -`sudo make uninstall` +```sh +sudo make uninstall +``` + +On BSD systems: + +```sh +doas gmake uninstall +``` ## Contributing diff --git a/pb b/pb index 164a41d..af225f6 100755 --- a/pb +++ b/pb @@ -1,14 +1,13 @@ #!/bin/sh # init variables -version="v2020.06.10" +version="v2020.07.05" ENDPOINT="https://ttm.sh" -flag_options=":hvcufs::x" +flag_options=":hvcufs::" flag_version=0 flag_help=0 flag_file=0 flag_url=0 -flag_shortlist=0 flag_colors=0 data="" @@ -93,9 +92,6 @@ while true; do -u) flag_url=1 ;; - -x) - flag_shortlist=1 - ;; --) shift break @@ -124,14 +120,6 @@ if [ ${flag_help} -gt 0 ]; then die "" 0 fi -# shortlist used for bash command completion -if [ ${flag_shortlist} -gt 0 ]; then - out="-f -v -h -s -c -u" - lsresults="$(ls)" - die "${out} ${lsresults}" 0 -fi - - # Colors if [ ${flag_colors} -gt 0 ]; then SUCCESS=$(tput setaf 190) diff --git a/pb.1 b/pb.1 index a3a6afe..a618e21 100644 --- a/pb.1 +++ b/pb.1 @@ -1,4 +1,4 @@ -.TH PB 1 "10 June 2020" "v2020.06.10" +.TH PB 1 "05 July 2020" "v2020.07.05" .SH NAME pb \- a helper utility for using 0x0 pastebin services diff --git a/pb.d b/pb.d deleted file mode 100644 index c15622b..0000000 --- a/pb.d +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -_pb() { -# Get basic autocomplete commands from the function itself - local helplist - helplist=$(pb -x) - -# Combine all the lists for autocomplete - local cur - cur=${COMP_WORDS[COMP_CWORD]} - COMPREPLY=( $( compgen -W "$helplist" -- "$cur" ) ) -} - -# Detect if current shell is ZSH, and if so, load this file in bash -# compatibility mode. -if [ -n "$ZSH_VERSION" ]; then - autoload bashcompinit - bashcompinit -fi - -complete -o default -o nospace -F _pb pb - -# The following are necessary only for Cygwin, and only are needed -# when the user has tab-completed the executable name and consequently -# included the '.exe' suffix. -if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then - complete -o default -o nospace -F _pb pb.exe -fi