When not run in a git repository, git-annex can still display a usage message, and "git annex version" even works.
Things that sound simple, but are made hard by the Annex monad being built with the assumption that there will always be a git repo.
This commit is contained in:
parent
84784e2ca1
commit
2bb6b02948
9 changed files with 38 additions and 18 deletions
10
Command.hs
10
Command.hs
|
@ -7,6 +7,7 @@
|
|||
|
||||
module Command (
|
||||
command,
|
||||
noRepo,
|
||||
next,
|
||||
stop,
|
||||
prepCommand,
|
||||
|
@ -31,9 +32,14 @@ import Logs.Trust
|
|||
import Logs.Location
|
||||
import Config
|
||||
|
||||
{- Generates a command with the common checks. -}
|
||||
{- Generates a normal command -}
|
||||
command :: String -> String -> [CommandSeek] -> String -> Command
|
||||
command = Command commonChecks
|
||||
command = Command Nothing commonChecks
|
||||
|
||||
{- Adds a fallback action to a command, that will be run if it's used
|
||||
- outside a git repository. -}
|
||||
noRepo :: IO () -> Command -> Command
|
||||
noRepo a c = c { cmdnorepo = Just a }
|
||||
|
||||
{- For start and perform stages to indicate what step to run next. -}
|
||||
next :: a -> Annex (Maybe a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue