Timew: use local var or unset them
This commit is contained in:
		
							parent
							
								
									344e18b126
								
							
						
					
					
						commit
						c13951a8bb
					
				
							
								
								
									
										16
									
								
								zshrc
								
								
								
								
							
							
						
						
									
										16
									
								
								zshrc
								
								
								
								
							|  | @ -407,14 +407,14 @@ alias taperso="task +perso | head" | |||
| 
 | ||||
| ## search a task by it's name (case INsensitive) {{{ | ||||
| function tase() { | ||||
| 	search=""; | ||||
| 	local search="" | ||||
| 	for i; do; search="$search /$i/"; done; | ||||
| 	task rc.search.case.sensitive:no $search all; | ||||
| } | ||||
| ## }}} | ||||
| ## search a task by it's name (case SENSITIVE) {{{ | ||||
| function tasec() { | ||||
| 	search=""; | ||||
| 	local search="" | ||||
| 	for i; do; search="$search /$i/"; done; | ||||
| 	task $search all; | ||||
| } | ||||
|  | @ -502,7 +502,7 @@ function tilastyear() { | |||
| ## "double" cause by default my tasks runs for 25 minutes | ||||
| function tidouble() { | ||||
| 	# Default duration time to add to a task | ||||
| 	tidouble_extra_time="25mins" | ||||
| 	local tidouble_extra_time="25mins" | ||||
| 
 | ||||
| 	# Verify argument | ||||
| 	if [ "${#}" -eq 1 ]; then | ||||
|  | @ -526,7 +526,7 @@ function tidouble() { | |||
| 	# }}} | ||||
| 
 | ||||
| 	# Get task's description from all task of this year | ||||
| 	tidouble_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tidouble_task_id} .*\)/\1/p" | sed 's/   */ − /g') | ||||
| 	local tidouble_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tidouble_task_id} .*\)/\1/p" | sed 's/   */ − /g') | ||||
| 
 | ||||
| 	printf '%b' "Add ${tidouble_extra_time} to \"${MAGENTAB}${tidouble_task_desc}${RESET}\" [Y/n] ? " | ||||
| 	read -r tidouble_confirmation | ||||
|  | @ -537,6 +537,9 @@ function tidouble() { | |||
| 		timew split @"${tidouble_task_id}" || return 0 | ||||
| 		printf '%b' "${tidouble_extra_time} were added to \"${MAGENTAB}${tidouble_task_desc}${RESET}\" task." | ||||
| 	fi | ||||
| 
 | ||||
| 	# Unset defined variables | ||||
| 	unset tidouble_confirmation tidouble_task_id | ||||
| } | ||||
| ## }}} | ||||
| ## Delete a time tracking {{{ | ||||
|  | @ -563,7 +566,7 @@ function tirm() { | |||
| 	# }}} | ||||
| 
 | ||||
| 	# Get task's description from all task of this year | ||||
| 	tirm_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tirm_task_id} .*\)/\1/p" | sed 's/   */ − /g') | ||||
| 	local tirm_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tirm_task_id} .*\)/\1/p" | sed 's/   */ − /g') | ||||
| 
 | ||||
| 	printf '%b' "Delete to \"${MAGENTAB}${tirm_task_desc}${RESET}\" [Y/n] ? " | ||||
| 	read -r tirm_confirmation | ||||
|  | @ -573,6 +576,9 @@ function tirm() { | |||
| 		timew delete @"${tirm_task_id}" || return 0 | ||||
| 		printf '%b' "${tirm_task_desc} was deleted" | ||||
| 	fi | ||||
| 
 | ||||
| 	# Unset defined variables | ||||
| 	unset tirm_confirmation tirm_task_id | ||||
| } | ||||
| ## }}} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue