put defualt configs in archive (crates.io doesn't allow "?")

This commit is contained in:
rabite 2019-07-01 19:25:45 +02:00
parent c2dafff622
commit 2c6be54944
35 changed files with 17 additions and 233 deletions

View File

@ -3,7 +3,7 @@ extern crate rustc_version;
use rustc_version::{version_meta, Channel};
use std::process::Command;
// use std::process::Command;
fn main() -> Result<(),()> {
@ -21,21 +21,24 @@ fn main() -> Result<(),()> {
return Err(());
}
// rename so we can just extract this into config dir later
Command::new("cp")
.args("-a extra hunter".split(" "))
.status()
.expect("Can't create copy of extra directory");
// crates.io doesn't allow question marks in file names
// So we just stuff that in an archive for distribution
// create archive that will be included in hunter binary
Command::new("tar")
.args("cfz config.tar.gz hunter".split(" "))
.status()
.expect("Failed to create archive of defualt config!");
// // rename so we can just extract this into config dir later
// Command::new("cp")
// .args("-a extra hunter".split(" "))
// .status()
// .expect("Can't create copy of extra directory");
// delete directory we just compressed
std::fs::remove_dir_all("hunter")
.expect("Couldn't delete temporary config directory \"hunter\"");
// // create archive that will be included in hunter binary
// Command::new("tar")
// .args("cfz config.tar.gz hunter".split(" "))
// .status()
// .expect("Failed to create archive of defualt config!");
// // delete directory we just compressed
// std::fs::remove_dir_all("hunter")
// .expect("Couldn't delete temporary config directory \"hunter\"");
return Ok(());
}

BIN
config.tar.gz Normal file

Binary file not shown.

View File

@ -1,84 +0,0 @@
#!/bin/sh
errecho() {
echo ${@} >&2
}
check_dir() {
DIR=${1}
[ -d ${DIR} ] ||
mkdir -p ${DIR} ||
(echo "Can't create directory: ${DIR}" && exit 1)
}
populate_file() {
FILE=${1}
# Don't try to overwrite existing file
test -e ${FILE} && return
cat > ${FILE} << EOF
#!/bin/sh
# Selected files are stored here
FILES=\${@}
# You can interate over them one by one
for FILE in \${FILES}; do
echo \$FILE
done
# Or process them all at once
echo "\${FILES}"
EOF
}
## Starting point
FILE=${1}
MIME=`hunter -m $FILE`
STATUS=$?
# MIME detection failed, bail out unless type is base
[ $STATUS != 0 ] && [ $type != "uni" ] &&
echo $MIME &&
exit 1
# Laziy not using XGD here because of OSX
ACTDIR="$HOME/.config/hunter/actions/"
MIME_BASE=`echo $MIME | cut -d "/" -f 1`
MIME_SUB=`echo $MIME | cut -d "/" -f 2`
case $type in
uni)
AFILE="${ACTDIR}/${name}.sh"
check_dir "${ACTDIR}"
populate_file "${AFILE}"
$EDITOR "${AFILE}"
test -e "${AFILE}" && chmod +x "${AFILE}"
;;
base)
BASEDIR="${ACTDIR}/$MIME_BASE"
AFILE="${BASEDIR}/${name}.sh"
check_dir "${BASEDIR}"
populate_file "${AFILE}"
$EDITOR "${AFILE}"
test -e ${AFILE} && chmod +x "${ACTDIR}/$name"
;;
sub)
SUBDIR="${ACTDIR}/${MIME_BASE}/${MIME_SUB}"
AFILE="${SUBDIR}/${name}.sh"
check_dir ${SUBDIR}
populate_file "${AFILE}"
$EDITOR "${AFILE}"
test -e ${AFILE} && chmod+ +x ${AFILE}
;;
esac

View File

@ -1,10 +0,0 @@
#!/bin/sh
which 7z >/dev/null && EXTRACTOR="7z x"
# Prefer aunpack
which aunpack >/dev/null && EXTRACTOR=aunpack
for file in "$@"; do
echo $EXTRACTOR "$file";
done

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z a $archive_name "$@"

View File

@ -1,3 +0,0 @@
#!/bin/sh
exec htop

View File

@ -1,3 +0,0 @@
#!/bin/sh
firefox "$@"

View File

@ -1,3 +0,0 @@
#!/bin/sh
nano "$@"

View File

@ -1,3 +0,0 @@
#!/bin/sh
exec mpv "$@"

View File

@ -1,15 +0,0 @@
#!/bin/sh
FORMATS=`youtube-dl -F "$url"`
echo $FORMATS
echo $FORMATS | grep "251 " &&
youtube-dl -x -f 251 "$url" &&
exit 0
echo $FORMATS | grep "171 " &&
youtube-dl -x -f 171 "$url" &&
exit 0
exit 1

View File

@ -1,7 +0,0 @@
animation=on
show_hidden=off
select_cmd=find -type f | fzf -m
cd_cmd=find -type d | fzf
icons=off
media_autostart=off
media_mute=off

View File

@ -1,6 +0,0 @@
function hunter() {
env hunter
test -e ~/.hunter_cwd &&
source ~/.hunter_cwd &&
rm ~/.hunter_cwd && cd $HUNTER_CWD
}

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,6 +0,0 @@
#!/bin/sh
w3m -dump "${1}" ||
links -dump "${1}" ||
elinks -dump "${1}" ||
lynx -dump "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
odt2text "${1}" 2> /dev/null

View File

@ -1,5 +0,0 @@
#!/bin/sh
pdftotext -l 10 -layout -nopgbrk -q "${1}" -||
mutool draw -F txt -i -- "${1}" ||
exiftool "${1}" 2> /dev/null

View File

@ -1,9 +0,0 @@
#!/bin/sh
bat --plain --color=always --paging=never "${1}" --line-range 1:100 --tabs 8
2>/dev/null && exit 5
highlight --replace-tabs=4 --force -- "${1}"
2>/dev/null && exit 5
cat "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,5 +0,0 @@
#!/bin/sh
pdftotext -l 10 -layout -nopgbrk -q "${1}" -||
mutool draw -F txt -i -- "${1}" ||
exiftool "${1}" 2> /dev/null

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"

View File

@ -1,3 +0,0 @@
#!/bin/sh
7z l -p -- "${1}"