| 
									
										
										
										
											2017-08-10 17:36:53 -05:00
										 |  |  | #!/bin/bash | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | command="$1" | 
					
						
							|  |  |  | option="$2" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | case "$command" in | 
					
						
							|  |  |  |     "new") | 
					
						
							|  |  |  |         # Start a new project | 
					
						
							|  |  |  |         mkdir -p ~/Documents/WorkTrack/"$option" | 
					
						
							| 
									
										
										
										
											2017-09-18 15:40:50 -05:00
										 |  |  |         cp /opt/worktrack/template.doc ~/Documents/WorkTrack/"$option"/track.doc | 
					
						
							|  |  |  |         chmod u+w ~/Documents/WorkTrack/"$option"/track.doc | 
					
						
							|  |  |  |         exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.doc | 
					
						
							| 
									
										
										
										
											2017-08-10 17:36:53 -05:00
										 |  |  |         ;; | 
					
						
							|  |  |  |     "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") | 
					
						
							| 
									
										
										
										
											2017-09-18 15:40:50 -05:00
										 |  |  |         exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.doc | 
					
						
							| 
									
										
										
										
											2017-08-10 17:36:53 -05:00
										 |  |  |         ;; | 
					
						
							|  |  |  |     *) | 
					
						
							|  |  |  |         echo Usage: $0 '[command]' | 
					
						
							|  |  |  |         echo Available commands: | 
					
						
							|  |  |  |         egrep '\"\) *$' $0 | cut -f 2 -d '"' | 
					
						
							|  |  |  |         exit 1; | 
					
						
							|  |  |  |         ;; | 
					
						
							|  |  |  | esac | 
					
						
							|  |  |  | exit 0 |