mirror of
https://tildegit.org/tomasino/pb.git
synced 2024-12-23 11:35:09 +01:00
removes ineffective bash completion. simplifies install
This commit is contained in:
parent
adbabea22a
commit
9d91448c3a
21
Makefile
21
Makefile
@ -12,21 +12,6 @@ INSTALL_DATA=$(INSTALL) -Dm 644
|
|||||||
bindir=$(DESTDIR)$(PREFIX)/bin
|
bindir=$(DESTDIR)$(PREFIX)/bin
|
||||||
sharedir=$(DESTDIR)$(PREFIX)/share
|
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:
|
help:
|
||||||
@echo "targets:"
|
@echo "targets:"
|
||||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||||
@ -36,15 +21,9 @@ help:
|
|||||||
install: pb pb.1 ## system install
|
install: pb pb.1 ## system install
|
||||||
$(INSTALL_PROGRAM) pb $(bindir)/pb
|
$(INSTALL_PROGRAM) pb $(bindir)/pb
|
||||||
$(INSTALL_DATA) pb.1 $(sharedir)/man/man1/pb.1
|
$(INSTALL_DATA) pb.1 $(sharedir)/man/man1/pb.1
|
||||||
ifdef cpldir
|
|
||||||
$(INSTALL_DATA) pb.d $(cpldir)/pb
|
|
||||||
endif
|
|
||||||
|
|
||||||
uninstall: ## system uninstall
|
uninstall: ## system uninstall
|
||||||
rm -f $(bindir)/pb
|
rm -f $(bindir)/pb
|
||||||
rm -f $(sharedir)/man/man1/pb.1
|
rm -f $(sharedir)/man/man1/pb.1
|
||||||
ifdef cpldir
|
|
||||||
rm -f $(cpldir)/pb
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: install uninstall help
|
.PHONY: install uninstall help
|
||||||
|
22
README.md
22
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
|
**pb** is a helper utility for using 0x0 pastebin services
|
||||||
@ -54,21 +54,27 @@ pb -u https://google.com
|
|||||||
|
|
||||||
On GNU systems:
|
On GNU systems:
|
||||||
|
|
||||||
`sudo make install`
|
```sh
|
||||||
|
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._
|
|
||||||
|
|
||||||
On BSD systems:
|
On BSD systems:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
install 755 pb /usr/local/bin
|
doas gmake install
|
||||||
install 644 pb /usr/local/man/man1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Uninstall
|
### Uninstall
|
||||||
|
|
||||||
`sudo make uninstall`
|
```sh
|
||||||
|
sudo make uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
On BSD systems:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
doas gmake uninstall
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
16
pb
16
pb
@ -1,14 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# init variables
|
# init variables
|
||||||
version="v2020.06.10"
|
version="v2020.07.05"
|
||||||
ENDPOINT="https://ttm.sh"
|
ENDPOINT="https://ttm.sh"
|
||||||
flag_options=":hvcufs::x"
|
flag_options=":hvcufs::"
|
||||||
flag_version=0
|
flag_version=0
|
||||||
flag_help=0
|
flag_help=0
|
||||||
flag_file=0
|
flag_file=0
|
||||||
flag_url=0
|
flag_url=0
|
||||||
flag_shortlist=0
|
|
||||||
flag_colors=0
|
flag_colors=0
|
||||||
data=""
|
data=""
|
||||||
|
|
||||||
@ -93,9 +92,6 @@ while true; do
|
|||||||
-u)
|
-u)
|
||||||
flag_url=1
|
flag_url=1
|
||||||
;;
|
;;
|
||||||
-x)
|
|
||||||
flag_shortlist=1
|
|
||||||
;;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -124,14 +120,6 @@ if [ ${flag_help} -gt 0 ]; then
|
|||||||
die "" 0
|
die "" 0
|
||||||
fi
|
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
|
# Colors
|
||||||
if [ ${flag_colors} -gt 0 ]; then
|
if [ ${flag_colors} -gt 0 ]; then
|
||||||
SUCCESS=$(tput setaf 190)
|
SUCCESS=$(tput setaf 190)
|
||||||
|
2
pb.1
2
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
|
.SH NAME
|
||||||
pb \- a helper utility for using 0x0 pastebin services
|
pb \- a helper utility for using 0x0 pastebin services
|
||||||
|
28
pb.d
28
pb.d
@ -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
|
|
Loading…
Reference in New Issue
Block a user