Replace python slugify and str2hex with go tools

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-12-15 12:12:24 +01:00
parent 92ee938c64
commit 2387473854
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 4 additions and 14 deletions

View file

@ -1,12 +0,0 @@
#!/usr/bin/env python
from slugify import slugify
import sys
def main(args):
print slugify(' '.join(args))
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View file

@ -25,6 +25,8 @@ INSTALLS=(
'github.com/Luzifer/password' 'github.com/Luzifer/password'
'github.com/Luzifer/short_path' 'github.com/Luzifer/short_path'
'github.com/Luzifer/share' 'github.com/Luzifer/share'
'github.com/Luzifer/slugify'
'github.com/Luzifer/str2hex'
) )

View file

@ -2,7 +2,7 @@
KEY=$1 KEY=$1
if [ -z "${KEY}" ] || ! (gpg2 --list-secret-keys | grep -q ${KEY}); then if [ -z "${KEY}" ] || ! (gpg2 --list-secret-keys ${KEY}); then
echo "No key given or no secret key found for '${KEY}'" echo "No key given or no secret key found for '${KEY}'"
exit 2 exit 2
fi fi
@ -15,7 +15,7 @@ if [ -z "${PWD}" ]; then
exit 2 exit 2
fi fi
HEXPWD=$(python3 -c "import binascii; print(binascii.hexlify(bytearray('${PWD}', 'utf-8')))") HEXPWD=$(echo -n "${PWD}" | str2hex)
# Get keygrip of secret key # Get keygrip of secret key
for KEYGRIP in $(gpg2 --with-keygrip -k ${KEY} | grep Keygrip | cut -d '=' -f 2 | xargs); do for KEYGRIP in $(gpg2 --with-keygrip -k ${KEY} | grep Keygrip | cut -d '=' -f 2 | xargs); do