update sf
This commit is contained in:
parent
9e399abdf9
commit
0b679c4a01
2 changed files with 16 additions and 8 deletions
|
|
@ -52,13 +52,12 @@
|
|||
TO_FORMAT To format
|
||||
|
||||
OPTIONS
|
||||
-h, --help Show this help message
|
||||
-d, --directory DIRECTORY Convert files in DIRECTORY (default: current work
|
||||
directory)
|
||||
-k, --keep Keep original files
|
||||
-l, --list List files which match the FROM_FORMAT
|
||||
-m, --move DIRECTORY Move old files to DIRECTORY (omits --keep)
|
||||
(default: )
|
||||
-h, --help Show this help message and exit
|
||||
|
||||
EXAMPLES
|
||||
ffconv mp3 opus Convert all mp3 files to opus
|
||||
|
|
@ -92,11 +91,11 @@
|
|||
FILE File which will be cutted
|
||||
|
||||
OPTIONS
|
||||
-h, --help Show this help message
|
||||
-f, --from TIMESTAMP/SECONDS Extract from TIMESTAMP/SECONDS (default: 0)
|
||||
-o, --out FILE Save extracted part to FILE (default:
|
||||
cutted_<filename>)
|
||||
-t, --to TIMESTAMP/DURATION Extract to TIMESTAMP/DURATION (default: end)
|
||||
-h, --help Show this help message and exit
|
||||
|
||||
EXAMPLES
|
||||
ffcut -t 5 video.mp4 -o cut.webm Extract the first five seconds of
|
||||
|
|
|
|||
19
lib/sf
19
lib/sf
|
|
@ -71,7 +71,7 @@ declare -A _sfflags
|
|||
declare -A _sfargs
|
||||
|
||||
# Parse sf arguments
|
||||
sfargs=("help;h;Show this help message" "${sfargs[@]}")
|
||||
sfargs=("${sfargs[@]}" "help;h;Show this help message and exit")
|
||||
for a in "${sfargs[@]}"; do
|
||||
|
||||
# Get amount of ;
|
||||
|
|
@ -184,7 +184,7 @@ _sfwidth=$(stty size | cut -d ' ' -f 2)
|
|||
_sfpdesc=""
|
||||
for i in "${!_sfptails[@]}"; do
|
||||
_sfptail="${_sfptails[$i]}"
|
||||
if [ $(( "${#_sfptail}" + "$_sfpoffset" )) -gt "$_sfwidth" ]; then
|
||||
if [ "$(( ${#_sfptail} + _sfpoffset ))" -gt "$_sfwidth" ]; then
|
||||
_sftmpwidth="$(( _sfwidth - _sfpoffset ))"
|
||||
_sftmpwidth=$(echo -e "${_sftmpwidth}\n1" | sort -nr | head -n 1)
|
||||
_sfptail=$(echo "$_sfptail" | fold -s -w "$_sftmpwidth")
|
||||
|
|
@ -197,7 +197,7 @@ done
|
|||
_sfodesc=""
|
||||
for i in "${!_sfotails[@]}"; do
|
||||
_sfotail="${_sfotails[$i]}"
|
||||
if [ $(( "${#_sfotail}" + "$_sfooffset" )) -gt "$_sfwidth" ]; then
|
||||
if [ "$(( ${#_sfotail} + _sfooffset ))" -gt "$_sfwidth" ]; then
|
||||
_sftmpwidth="$(( _sfwidth - _sfooffset ))"
|
||||
_sftmpwidth=$(echo -e "${_sftmpwidth}\n1" | sort -nr | head -n 1)
|
||||
_sfotail=$(echo "$_sfotail" | fold -s -w "$_sftmpwidth")
|
||||
|
|
@ -210,7 +210,7 @@ done
|
|||
_sfexamples=""
|
||||
for i in "${!_sfetails[@]}"; do
|
||||
_sfetail="${_sfetails[$i]}"
|
||||
if [ $(( "${#_sfetail}" + "$_sfeoffset" )) -gt "$_sfwidth" ]; then
|
||||
if [ "$(( ${#_sfetail} + _sfeoffset ))" -gt "$_sfwidth" ]; then
|
||||
_sftmpwidth="$(( _sfwidth - _sfeoffset ))"
|
||||
_sftmpwidth=$(echo -e "${_sftmpwidth}\n1" | sort -nr | head -n 1)
|
||||
_sfetail=$(echo "$_sfetail" | fold -s -w "$_sftmpwidth")
|
||||
|
|
@ -250,6 +250,15 @@ for a in "$@"; do
|
|||
[ "$a" == "-h" ] || [ "$a" == "--help" ] && _sfusage
|
||||
done
|
||||
|
||||
# Check if dependencies are available
|
||||
for d in "${sfdeps[@]}"; do
|
||||
if ! command -v "$d" &> /dev/null; then
|
||||
sferr "Command ${sftbf}${d}${sftrs} not found" 0
|
||||
_sfdeperr=true
|
||||
fi
|
||||
done
|
||||
[ "$_sfdeperr" == true ] && exit 1
|
||||
|
||||
# Parse arguments
|
||||
while (( "$#" )); do
|
||||
|
||||
|
|
@ -301,4 +310,4 @@ if [ "${#_sfpargs[@]}" -gt 0 ]; then
|
|||
fi
|
||||
|
||||
# Unset all internal variables and functions
|
||||
unset a e i _sfargs _sfehead _sfeheads _sfeoffset _sferr _sfetails _sfexamples _sfflags _sfodesc _sfohead _sfoheads _sfooffset _sfotails _sfpargs _sfparr _sfpdesc _sfphead _sfpheads _sfplast _sfpoffset _sfptails _sfpusage _sftmpwidth _sfusage _sfwidth
|
||||
unset a d e i OLDIFS _sfargs _sfehead _sfeheads _sfeoffset _sferr _sfetails _sfexamples _sfflags _sfodesc _sfohead _sfoheads _sfooffset _sfotails _sfpargs _sfparr _sfpdesc _sfphead _sfpheads _sfplast _sfpoffset _sfptails _sfpusage _sftmpwidth _sfusage _sfwidth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue