 4781ca297b
			
		
	
	
	
	
	4781ca297bClean up some uses of showStart with "" for the file, or in some cases, a non-filename description string. That would generate bad json, although none of the commands doing that supported --json. Using "" for the file resulted in output like "foo rest"; now the extra space is eliminated. This commit was sponsored by Fernando Jimenez on Patreon.
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			832 B
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			832 B
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
| {- git-annex command
 | |
|  -
 | |
|  - Copyright 2014 Joey Hess <id@joeyh.name>
 | |
|  -
 | |
|  - Licensed under the GNU GPL version 3 or higher.
 | |
|  -}
 | |
| 
 | |
| module Command.Reinit where
 | |
| 
 | |
| import Command
 | |
| import Annex.Init
 | |
| import Annex.UUID
 | |
| import qualified Remote
 | |
| import qualified Annex.SpecialRemote
 | |
| 	
 | |
| cmd :: Command
 | |
| cmd = dontCheck repoExists $
 | |
| 	command "reinit" SectionUtility 
 | |
| 		"initialize repository, reusing old UUID"
 | |
| 		(paramUUID ++ "|" ++ paramDesc)
 | |
| 		(withParams seek)
 | |
| 
 | |
| seek :: CmdParams -> CommandSeek
 | |
| seek = withWords start
 | |
| 
 | |
| start :: [String] -> CommandStart
 | |
| start ws = do
 | |
| 	showStart' "reinit" (Just s)
 | |
| 	next $ perform s
 | |
|   where
 | |
| 	s = unwords ws
 | |
| 
 | |
| perform :: String -> CommandPerform
 | |
| perform s = do
 | |
| 	u <- if isUUID s
 | |
| 		then return $ toUUID s
 | |
| 		else Remote.nameToUUID s
 | |
| 	storeUUID u
 | |
| 	initialize' Nothing
 | |
| 	Annex.SpecialRemote.autoEnable
 | |
| 	next $ return True
 |