refactor some boilerplate
This commit is contained in:
		
					parent
					
						
							
								b400984ddf
							
						
					
				
			
			
				commit
				
					
						56bc3e95ca
					
				
			
		
					 31 changed files with 93 additions and 86 deletions
				
			
		| 
						 | 
				
			
			@ -26,20 +26,19 @@ start key = do
 | 
			
		|||
	present <- inAnnex key
 | 
			
		||||
	force <- Annex.getState Annex.force
 | 
			
		||||
	if not present
 | 
			
		||||
		then return Nothing
 | 
			
		||||
		then stop
 | 
			
		||||
		else if not force
 | 
			
		||||
			then error "dropkey is can cause data loss; use --force if you're sure you want to do this"
 | 
			
		||||
			else do
 | 
			
		||||
				showStart "dropkey" (show key)
 | 
			
		||||
				return $ Just $ perform key
 | 
			
		||||
				next $ perform key
 | 
			
		||||
 | 
			
		||||
perform :: Key -> CommandPerform
 | 
			
		||||
perform key = do
 | 
			
		||||
	removeAnnex key
 | 
			
		||||
	return $ Just $ cleanup key
 | 
			
		||||
	next $ cleanup key
 | 
			
		||||
 | 
			
		||||
cleanup :: Key -> CommandCleanup
 | 
			
		||||
cleanup key = do
 | 
			
		||||
	logStatus key ValueMissing
 | 
			
		||||
	return True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue