add --json-error-messages (not yet implemented)
Added --json-error-messages option, which includes error messages in the json output, rather than outputting them to stderr. The actual rediretion of errors is not implemented yet, this is only the docs and option plumbing. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
fa65f1d240
commit
6583448bab
46 changed files with 164 additions and 69 deletions
|
@ -22,9 +22,10 @@ import Annex.Version
|
|||
import Git.FilePath
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withGlobalOptions (jobsOption : jsonOption : fileMatchingOptions) $
|
||||
command "add" SectionCommon "add files to annex"
|
||||
paramPaths (seek <$$> optParser)
|
||||
cmd = notBareRepo $
|
||||
withGlobalOptions [jobsOption, jsonOptions, fileMatchingOptions] $
|
||||
command "add" SectionCommon "add files to annex"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
||||
data AddOptions = AddOptions
|
||||
{ addThese :: CmdParams
|
||||
|
|
|
@ -34,7 +34,7 @@ import Utility.Path.Max
|
|||
import qualified Annex.Transfer as Transfer
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withGlobalOptions [jobsOption, jsonOption, jsonProgressOption] $
|
||||
cmd = notBareRepo $ withGlobalOptions [jobsOption, jsonOptions, jsonProgressOption] $
|
||||
command "addurl" SectionCommon "add urls to annex"
|
||||
(paramRepeating paramUrl) (seek <$$> optParser)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import Annex.Wanted
|
|||
import Annex.NumCopies
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, jsonProgressOption, annexedMatchingOptions] $
|
||||
command "copy" SectionCommon
|
||||
"copy content of files to/from another repository"
|
||||
paramPaths (seek <--< optParser)
|
||||
|
|
|
@ -23,7 +23,7 @@ import System.Log.Logger (debugM)
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, annexedMatchingOptions] $
|
||||
command "drop" SectionCommon
|
||||
"remove content of files from repository"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -13,7 +13,7 @@ import Logs.Location
|
|||
import Annex.Content
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withGlobalOptions [jsonOption] $
|
||||
cmd = noCommit $ withGlobalOptions [jsonOptions] $
|
||||
command "dropkey" SectionPlumbing
|
||||
"drops annexed content for specified keys"
|
||||
(paramRepeating paramKey)
|
||||
|
|
|
@ -13,7 +13,7 @@ import Command.Find (parseFormatOption, showFormatted, keyVars)
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ noMessages $ dontCheck repoExists $
|
||||
withGlobalOptions [jsonOption] $
|
||||
withGlobalOptions [jsonOptions] $
|
||||
command "examinekey" SectionPlumbing
|
||||
"prints information from a key"
|
||||
(paramRepeating paramKey)
|
||||
|
|
|
@ -18,12 +18,12 @@ import qualified Utility.Format
|
|||
import Utility.DataUnits
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions annexedMatchingOptions $ mkCommand $
|
||||
cmd = withGlobalOptions [annexedMatchingOptions] $ mkCommand $
|
||||
command "find" SectionQuery "lists available files"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
||||
mkCommand :: Command -> Command
|
||||
mkCommand = noCommit . noMessages . withGlobalOptions [jsonOption]
|
||||
mkCommand = noCommit . noMessages . withGlobalOptions [jsonOptions]
|
||||
|
||||
data FindOptions = FindOptions
|
||||
{ findThese :: CmdParams
|
||||
|
|
|
@ -12,7 +12,7 @@ import qualified Command.Find as Find
|
|||
import qualified Git
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions nonWorkTreeMatchingOptions $ Find.mkCommand $
|
||||
cmd = withGlobalOptions [nonWorkTreeMatchingOptions] $ Find.mkCommand $
|
||||
command "findref" SectionPlumbing
|
||||
"lists files in a git ref"
|
||||
paramRef (seek <$$> Find.optParser)
|
||||
|
|
|
@ -23,7 +23,7 @@ import Utility.Touch
|
|||
#endif
|
||||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ noCommit $ withGlobalOptions annexedMatchingOptions $
|
||||
cmd = notDirect $ noCommit $ withGlobalOptions [annexedMatchingOptions] $
|
||||
command "fix" SectionMaintenance
|
||||
"fix up links to annexed content"
|
||||
paramPaths (withParams seek)
|
||||
|
|
|
@ -45,7 +45,7 @@ import qualified Data.Set as S
|
|||
import qualified Data.Map as M
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, annexedMatchingOptions] $
|
||||
command "fsck" SectionMaintenance
|
||||
"find and fix problems"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -16,7 +16,7 @@ import Annex.Wanted
|
|||
import qualified Command.Move
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, jsonProgressOption, annexedMatchingOptions] $
|
||||
command "get" SectionCommon
|
||||
"make content of annexed files available"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -24,10 +24,11 @@ import Utility.InodeCache
|
|||
import Logs.Location
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : fileMatchingOptions) $ notBareRepo $
|
||||
command "import" SectionCommon
|
||||
"move and add files from outside git working copy"
|
||||
paramPaths (seek <$$> optParser)
|
||||
cmd = notBareRepo $
|
||||
withGlobalOptions [jobsOption, jsonOptions, fileMatchingOptions] $
|
||||
command "import" SectionCommon
|
||||
"move and add files from outside git working copy"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
||||
data DuplicateMode = Default | Duplicate | DeDuplicate | CleanDuplicates | SkipDuplicates | ReinjectDuplicates
|
||||
deriving (Eq)
|
||||
|
|
|
@ -84,7 +84,7 @@ emptyStatInfo = StatInfo Nothing Nothing M.empty Nothing
|
|||
type StatState = StateT StatInfo Annex
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
|
||||
cmd = noCommit $ withGlobalOptions [jsonOptions, annexedMatchingOptions] $
|
||||
command "info" SectionQuery
|
||||
"shows information about the specified item or the repository as a whole"
|
||||
(paramRepeating paramItem) (seek <$$> optParser)
|
||||
|
|
|
@ -22,7 +22,7 @@ import Git.Types (RemoteName)
|
|||
import Utility.Tuple
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withGlobalOptions annexedMatchingOptions $
|
||||
cmd = noCommit $ withGlobalOptions [annexedMatchingOptions] $
|
||||
command "list" SectionQuery
|
||||
"show which remotes contain files"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -23,7 +23,7 @@ import Logs.Location
|
|||
import Git.FilePath
|
||||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
|
||||
cmd = notDirect $ withGlobalOptions [jsonOptions, annexedMatchingOptions] $
|
||||
command "lock" SectionCommon
|
||||
"undo unlock command"
|
||||
paramPaths (withParams seek)
|
||||
|
|
|
@ -40,7 +40,7 @@ data LogChange = Added | Removed
|
|||
type Outputter = LogChange -> POSIXTime -> [UUID] -> Annex ()
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions annexedMatchingOptions $
|
||||
cmd = withGlobalOptions [annexedMatchingOptions] $
|
||||
command "log" SectionQuery "shows location log"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import Data.Aeson
|
|||
import Control.Concurrent
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions ([jsonOption] ++ annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jsonOptions, annexedMatchingOptions] $
|
||||
command "metadata" SectionMetaData
|
||||
"sets or gets metadata of a file"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -20,7 +20,7 @@ import Logs.Web
|
|||
import qualified Remote
|
||||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ withGlobalOptions annexedMatchingOptions $
|
||||
cmd = notDirect $ withGlobalOptions [annexedMatchingOptions] $
|
||||
command "migrate" SectionUtility
|
||||
"switch data to different backend"
|
||||
paramPaths (withParams seek)
|
||||
|
|
|
@ -17,7 +17,7 @@ import Annex.NumCopies
|
|||
import Types.Transfer
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, jsonProgressOption, annexedMatchingOptions] $
|
||||
command "mirror" SectionCommon
|
||||
"mirror content of files to/from another repository"
|
||||
paramPaths (seek <--< optParser)
|
||||
|
|
|
@ -20,7 +20,7 @@ import Annex.NumCopies
|
|||
import System.Log.Logger (debugM)
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions [jobsOption, jsonOptions, jsonProgressOption, annexedMatchingOptions] $
|
||||
command "move" SectionCommon
|
||||
"move content of files to/from another repository"
|
||||
paramPaths (seek <--< optParser)
|
||||
|
|
|
@ -17,7 +17,7 @@ import Git.FilePath
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ noCommit $ noMessages $
|
||||
withGlobalOptions [jsonOption] $
|
||||
withGlobalOptions [jsonOptions] $
|
||||
command "status" SectionCommon
|
||||
"show the working tree status"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
|
@ -24,7 +24,7 @@ import qualified Database.Keys
|
|||
import Git.FilePath
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions annexedMatchingOptions $
|
||||
cmd = withGlobalOptions [annexedMatchingOptions] $
|
||||
command "unannex" SectionUtility
|
||||
"undo accidental add command"
|
||||
paramPaths (withParams seek)
|
||||
|
|
|
@ -26,8 +26,9 @@ editcmd :: Command
|
|||
editcmd = mkcmd "edit" "same as unlock"
|
||||
|
||||
mkcmd :: String -> String -> Command
|
||||
mkcmd n d = notDirect $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
|
||||
command n SectionCommon d paramPaths (withParams seek)
|
||||
mkcmd n d = notDirect $
|
||||
withGlobalOptions [jsonOptions, annexedMatchingOptions] $
|
||||
command n SectionCommon d paramPaths (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = withFilesInGit (whenAnnexed start) =<< workTreeItems ps
|
||||
|
|
|
@ -17,7 +17,7 @@ import Annex.UUID
|
|||
import qualified Data.Map as M
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
|
||||
cmd = noCommit $ withGlobalOptions [jsonOptions, annexedMatchingOptions] $
|
||||
command "whereis" SectionQuery
|
||||
"lists repositories that have file content"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue