show full usage
This commit is contained in:
		
					parent
					
						
							
								c69e747d38
							
						
					
				
			
			
				commit
				
					
						96347a25a2
					
				
			
		
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -67,9 +67,9 @@ parseCmd :: [String] -> AnnexState -> IO ([Flag], [Annex ()])
 | 
				
			||||||
parseCmd argv state = do
 | 
					parseCmd argv state = do
 | 
				
			||||||
	(flags, params) <- getopt
 | 
						(flags, params) <- getopt
 | 
				
			||||||
	case (length params) of
 | 
						case (length params) of
 | 
				
			||||||
		0 -> error header
 | 
							0 -> error usage
 | 
				
			||||||
		_ -> case (lookupCmd (params !! 0)) of
 | 
							_ -> case (lookupCmd (params !! 0)) of
 | 
				
			||||||
			[] -> error header
 | 
								[] -> error usage
 | 
				
			||||||
			[Command _ action want] -> do
 | 
								[Command _ action want] -> do
 | 
				
			||||||
				f <- findWanted want (drop 1 params)
 | 
									f <- findWanted want (drop 1 params)
 | 
				
			||||||
					(BackendTypes.repo state)
 | 
										(BackendTypes.repo state)
 | 
				
			||||||
| 
						 | 
					@ -77,10 +77,11 @@ parseCmd argv state = do
 | 
				
			||||||
	where
 | 
						where
 | 
				
			||||||
		getopt = case getOpt Permute options argv of
 | 
							getopt = case getOpt Permute options argv of
 | 
				
			||||||
			(flags, params, []) -> return (flags, params)
 | 
								(flags, params, []) -> return (flags, params)
 | 
				
			||||||
			(_, _, errs) -> ioError (userError (concat errs ++ usageInfo header options))
 | 
								(_, _, errs) -> ioError (userError (concat errs ++ usage))
 | 
				
			||||||
		lookupCmd cmd = filter (\c -> cmd  == cmdname c) cmds
 | 
							lookupCmd cmd = filter (\c -> cmd  == cmdname c) cmds
 | 
				
			||||||
		header = "Usage: git-annex [" ++ 
 | 
							header = "Usage: git-annex [" ++ 
 | 
				
			||||||
			(join "|" $ map cmdname cmds) ++ "] ..."
 | 
								(join "|" $ map cmdname cmds) ++ "] ..."
 | 
				
			||||||
 | 
							usage = usageInfo header options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{- Annexes a file, storing it in a backend, and then moving it into
 | 
					{- Annexes a file, storing it in a backend, and then moving it into
 | 
				
			||||||
 - the annex directory and setting up the symlink pointing to its content. -}
 | 
					 - the annex directory and setting up the symlink pointing to its content. -}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue