~skiqqy/q

ddd2ed1afc463d2fe9074639694b3eb1fa26c628 — Stephen Cochrane 1 year, 8 months ago 0cd02f7
Added helper funcs
1 files changed, 15 insertions(+), 1 deletions(-)

M q
M q => q +15 -1
@@ 106,7 106,8 @@ qpush()
	fi

	read -rp "Title: " title
	read -rp "Desc: "  desc
	write_desc
	desc="$(tr_desc)"

	if [ "$prio" = "$(tail -1 "$q" | cut -d"$delim" -f3)" ] # If max prio, simply put on top of stack.
	then


@@ 211,6 212,19 @@ qclean()
	rm "$qdir/"{q,id}
}

# Write a description in your editor
write_desc()
{
	> "$qdir/buffer" # Clear the buffer
	$EDITOR "$qdir/buffer"
}

# Translates a description, and prints the result to stdout
tr_desc()
{
	tr '\n' "$delim" < "$qdir/buffer" | sed "s|$delim|\\\n|g" # Replace newlines with \n
}

# Read a string and split it into vars
parse()
{