Adding work tracker
This commit is contained in:
parent
aa7f6f7c8f
commit
ec85c68ea5
60
Shared/worktrack
Normal file
60
Shared/worktrack
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
command="$1"
|
||||||
|
option="$2"
|
||||||
|
|
||||||
|
# Sanity checks
|
||||||
|
if [ ! -x "$(which libreoffice)" ]; then
|
||||||
|
echo Needs libreoffice.
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ ! -f /opt/worktrack/template.odt ]; then
|
||||||
|
echo Needs template document in /opt/worktrack/template.odt
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
"new")
|
||||||
|
# Start a new project
|
||||||
|
mkdir -p ~/Documents/WorkTrack/"$option"
|
||||||
|
cp /opt/worktrack/template.odt ~/Documents/WorkTrack/"$option"/track.odt
|
||||||
|
chmod u+w ~/Documents/WorkTrack/"$option"/track.odt
|
||||||
|
exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.odt
|
||||||
|
;;
|
||||||
|
"list")
|
||||||
|
# Show available projects
|
||||||
|
ls -l ~/Documents/WorkTrack
|
||||||
|
;;
|
||||||
|
"complete")
|
||||||
|
# Hide a project from listing.
|
||||||
|
mv ~/Documents/WorkTrack/"$option" ~/Documents/WorkTrack/\."$option"
|
||||||
|
;;
|
||||||
|
"cd")
|
||||||
|
# enter the directory
|
||||||
|
cd ~/Documents/WorkTrack/"$option"
|
||||||
|
if [ $? -eq 0 ]; then exec /bin/bash; fi
|
||||||
|
;;
|
||||||
|
"purge")
|
||||||
|
# Remove all completed projects
|
||||||
|
rm -Ri ~/Documents/WorkTrack/\.[a-zA-Z1-9]*
|
||||||
|
;;
|
||||||
|
"edit")
|
||||||
|
exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.odt
|
||||||
|
;;
|
||||||
|
"checkperm")
|
||||||
|
if [ `whoami` != "root" ]; then
|
||||||
|
echo "Need to be root."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
chown root: /opt/worktrack/template.odt /usr/local/bin/worktrack
|
||||||
|
chmod 0755 /usr/local/bin/worktrack
|
||||||
|
chmod 0644 /opt/worktrack/template.odt
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo Usage: $0 '[command]'
|
||||||
|
echo Available commands:
|
||||||
|
egrep '\"\) *$' $0 | cut -f 2 -d '"'
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user