Compare commits
8 Commits
1a8d336522
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bad4adacda | |||
| 32484f98fb | |||
| c4e275a209 | |||
| d74a5f4eea | |||
| 3c8ca3814f | |||
| 4ebec5f008 | |||
| 503e4de0cd | |||
| e6138ddc72 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
pkg
|
||||||
|
old
|
||||||
|
src
|
||||||
|
|
||||||
|
*.pkg.tar.*
|
||||||
23
PKGBUILD
23
PKGBUILD
@@ -1,14 +1,27 @@
|
|||||||
# PKGBUILD
|
# PKGBUILD
|
||||||
pkgname=comp
|
pkgname=comp
|
||||||
pkgver=1.0
|
pkgver=1.2
|
||||||
pkgrel=1
|
pkgrel=6
|
||||||
pkgdesc="Simple folder compression with pv and pigz"
|
pkgdesc="Simple folder compression with pv and pigz"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
license=('MIT')
|
license=('MIT')
|
||||||
depends=('tar' 'pv' 'pigz')
|
deps=('tar>0.0.0' 'pv>0.0.0' 'pigz>0.0.0')
|
||||||
source=('comp.sh')
|
source=('comp.sh' 'comp.bash' '_comp')
|
||||||
md5sums=('SKIP')
|
maintainer="Zacharias Zellén <zacharias@4zellen.se>"
|
||||||
|
url="https://server.4zellen.se:3000/Zacharias/comp"
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
sed -i "s/__VERSION__/$pkgver/" "$srcdir/comp.sh"
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm755 "$srcdir/comp.sh" "$pkgdir/usr/bin/comp"
|
install -Dm755 "$srcdir/comp.sh" "$pkgdir/usr/bin/comp"
|
||||||
|
|
||||||
|
install -Dm644 "$srcdir/comp.bash" "$pkgdir/usr/share/bash-completion/completions/comp"
|
||||||
|
|
||||||
|
install -Dm644 "$srcdir/_comp" "$pkgdir/usr/share/zsh/site-functions/_comp"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sha256sums=('27ad990dc4eded0204660e9da704a92ca33b52e63014e9c731f771bf942be7f3'
|
||||||
|
'e90c5e24ad932296b932a8dd0cfcc42051209a755828408229d73c2dc6321e83'
|
||||||
|
'8ed621a9435b3f6d066abde2fb7eae964dda82ab90824b7fc07d167834863633')
|
||||||
|
|||||||
19
_comp
Normal file
19
_comp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#compdef comp
|
||||||
|
|
||||||
|
_comp() {
|
||||||
|
_arguments \
|
||||||
|
'-h[Prints help message]' \
|
||||||
|
'--help[Prints help message]' \
|
||||||
|
'-v[Print version]' \
|
||||||
|
'--version[Print version]' \
|
||||||
|
'1:file or folder to compress:_files_or_dirs' \
|
||||||
|
'2:output file:_files'
|
||||||
|
|
||||||
|
# Custom function to complete both files and directories
|
||||||
|
_files_or_dirs() {
|
||||||
|
_alternative \
|
||||||
|
'directories:: _directories' \
|
||||||
|
'files:: _files'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
comp.bash
Normal file
23
comp.bash
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# completions/comp.bash
|
||||||
|
_comp_completions()
|
||||||
|
{
|
||||||
|
local cur prev opts
|
||||||
|
COMPREPLY=()
|
||||||
|
cur = "${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev = "${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
opts = "-h --help -v --version"
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY = ( $(compgen -W "${opts}" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $COMP_CWORD -eq 1 ]]; then
|
||||||
|
COMPREPLY=( $(compgen -d -- "$cur") $(compgen -f -- "$cur"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _comp_completions comp
|
||||||
24
comp.sh
Normal file → Executable file
24
comp.sh
Normal file → Executable file
@@ -3,8 +3,30 @@
|
|||||||
# Usage: comp <folder_to_compress> [output_fildename]
|
# Usage: comp <folder_to_compress> [output_fildename]
|
||||||
|
|
||||||
# Check if input folder is provided
|
# Check if input folder is provided
|
||||||
|
|
||||||
|
VERSION="__VERSION__"
|
||||||
|
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
echo "Usage: comp <folder_to_compress> [output_filename]"
|
echo "Usage: comp <folder_or_file_to_compress> [output_file]"
|
||||||
|
echo "comp <options>"
|
||||||
|
exit 1
|
||||||
|
elif [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
echo "Usage:"
|
||||||
|
echo " comp <folder_or_file_to_compress> [output_file]"
|
||||||
|
echo " comp <option>"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h --help: Print's this message"
|
||||||
|
echo " -v --version: Ptints the current version"
|
||||||
|
exit 0
|
||||||
|
elif [[ "$1" == "-v" || "$1" == "--version" ]]; then
|
||||||
|
echo "comp version: $VERSION"
|
||||||
|
exit 0
|
||||||
|
elif [[ ! -d "$1" || ! -f "$1" ]]; then
|
||||||
|
echo "Invalid argument '$1'"
|
||||||
|
echo "Usage:"
|
||||||
|
echo " comp <folder_to_compress> [output_file]"
|
||||||
|
echo " comp <option>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user