Revert "Start re-write-- mainly lib/stic progress"

This reverts commit 6b06055eb8.
This commit is contained in:
Jaidyn Levesque 2018-02-11 14:14:23 -06:00
parent f0c50f588e
commit 253fb0f059
2 changed files with 0 additions and 125 deletions

View File

@ -1,52 +0,0 @@
OK, I'm re-writing shelltube.
It worked, but it was inflexible and total shit.
Yes, the dream is still POSIX. :)
Here is a general plan:
./shelltube Wrapper script for everything else. Slim and simple
./lib/yts Searches YT, outputs a comp-friendly list of results
./lib/ytc Lists videos on a YT channel/user-page
./lib/ytd Downloads/streams a YT video
./lib/stc Helps configure shelltube
./lib/stic Helps with cli arguments
./lib/sti Helps with trapped user input
Planned inputs & details:
./shelltube
shelltube [command(s) to run after startup]
./lib/yts
$ yts query [-o $outfile]
* Prints the results in the following format:
artist \t name \t length (?) \t ID
./lib/ytc
$ ytc query [-o $outfile]
* Prints the results in the following format:
name \t length (?) \t ID
./lib/ytd
$ ytd URL||ID [-o $outfile||-s]
./lib/stc
$ stc [-h||--home $homedir]
* Just creates/edits $HOME/.config/shelltube
./lib/stic
$ stic "$@" "[[syntax]] shortargf longargf argf
* Outputs commandline args to the specified files
for easier parsing
* dargf contains args like -c, -o, --config, etc.
* argf contains everything else, like 'filename' etc.
* [[syntax]] consists of something like this:
"[[(1|1|c|config)(1|0|v|verbose)(0|1|infile)(0|2|outfile)]]"
* Does it look terrible painful? Let me show you the anatomy of
one of those listed potential arugments:
* In a dashed arg (--config or -c), the syntax is this:
(1|0=no subsequent arg 1=subs. arg|short form|long form)
The "subsequent arg" means like 'file' in "--config file"
* In a non-dashed arg (infile or outfile), the syntax is this:
(0|position in input|name)
"Position in input" refers to the position it has in relation
to other non-dashed args.
The "name"
I'm working on stic riggt now. I think it'll really make shelltube (and
probably any other shell script I'll ever write!) a lot better and more
usable.

View File

@ -1,73 +0,0 @@
#!/bin/sh -e
#####################################################################################
# Name: stic
# Lisc: GPLv3
# Main: jadedctrl | jadedml@openmailbox.org
# Usage: $ stic "$@" "SYNTAX" argfile longargfile
# Desc: Makes handling cli arguments easier-- no more shitty case or if statements
# for us! ... or I'll throw myself against the nearest sharp object
#####################################################################################
ALL="$1"
SYNTAX="$2"
ARGFILE="$3"
LONGARGFILE="$4"
RANDID=$(mktemp -u XXXXXX)
LONGARGPROCFILE="/tmp/stic-long-${RANDID}.proc"
SHORTARGPROCFILE="/tmp/stic-short-${RANDID}.proc"
# Go through every () syntax statement; output in awk+grep-friendly format
syntaxproc="$(echo $SYNTAX | sed 's^ ^^g' | sed 's^)(^) (^g')"
for synarg in $(echo "$syntaxproc")
do
synargproc="$(echo "$synarg" | sed 's/(//' | sed 's/)//')"
argtype=$(echo "$synargproc" | awk -F "|" '{ print $1 }')
# Longargs go first
if [ $argtype -eq 0 ]
then
position=$(echo "$synargproc" | awk -F "|" '{ print $2 }')
name=$(echo "$synargproc" | awk -F "|" '{ print $3 }')
printf "%s\t%s\n" $position $name >> $LONGARGPROCFILE
# Now for the shortargs
elif [ $argtype -eq 1 ]
then
subsarg=$(echo "$synargproc" | awk -F "|" '{ print $2 }')
shortname=$(echo "$synargproc" | awk -F "|" '{ print $3 }')
longname=$(echo "$synargproc" | awk -F "|" '{ print $4 }')
printf "%s\t%s\t%s" $subsarg $shortname $longname >> $SHORTARGPROCFILE
if [ $subsarg -eq 1 ]
then
subsname=$(echo "$synargproc" | awk -F "|" '{ print $5 }')
printf "\t%s" $subsname >> $SHORTARGPROCFILE
fi
printf "\n" >> $SHORTARGPROCFILE
else
exit 1
fi
done
printf "Session ID: %s\n" $RANDID
cat $SHORTARGPROCFILE
cat $LONGARGPROCFILE
# At this point, the syntax is easy awk-parseable stored in the $*ARGPROCFILE files
position=0
for argument in "$(echo "$ALL")"
do
if echo "$argument" | grep "^\--"
then
argtype=1
if
else
if [ $insubsarg -eq 1 ]
then
printf "\t%s\n" $argument >> $SHORTARGFILE
argtype=0
position=$((position+1))