summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-26 15:53:01 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-26 15:53:01 -0400
commit541178b499d084e4041ae4b9d62bf86f5a97c3ff (patch)
treec47863a99db0631890802909583ac5003dda416f /Command
parent257d1136e4178665fd52f14a2d430f9ad819d45f (diff)
refactor
Diffstat (limited to 'Command')
-rw-r--r--Command/Drop.hs5
-rw-r--r--Command/DropKey.hs3
-rw-r--r--Command/Get.hs3
-rw-r--r--Command/Move.hs6
-rw-r--r--Command/Whereis.hs3
5 files changed, 6 insertions, 14 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index d17302035..0a6d61ba0 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -18,7 +18,6 @@ import Config.NumCopies
import Annex.Content
import qualified Option
import Annex.Wanted
-import Types.Key
def :: [Command]
def = [withOptions [fromOption] $ command "drop" paramPaths seek
@@ -45,12 +44,12 @@ start from file (key, _) = checkDropAuto from file key $ \numcopies ->
startLocal :: AssociatedFile -> NumCopies -> Key -> Maybe Remote -> CommandStart
startLocal afile numcopies key knownpresentremote = stopUnless (inAnnex key) $ do
- showStart "drop" (fromMaybe (key2file key) afile)
+ showStart' "drop" key afile
next $ performLocal key numcopies knownpresentremote
startRemote :: AssociatedFile -> NumCopies -> Key -> Remote -> CommandStart
startRemote afile numcopies key remote = do
- showStart ("drop " ++ Remote.name remote) (fromMaybe (key2file key) afile)
+ showStart' ("drop " ++ Remote.name remote) key afile
next $ performRemote key numcopies remote
performLocal :: Key -> NumCopies -> Maybe Remote -> CommandPerform
diff --git a/Command/DropKey.hs b/Command/DropKey.hs
index 002633e58..125e6ded4 100644
--- a/Command/DropKey.hs
+++ b/Command/DropKey.hs
@@ -12,7 +12,6 @@ import Command
import qualified Annex
import Logs.Location
import Annex.Content
-import Types.Key
def :: [Command]
def = [noCommit $ command "dropkey" (paramRepeating paramKey) seek
@@ -25,7 +24,7 @@ start :: Key -> CommandStart
start key = stopUnless (inAnnex key) $ do
unlessM (Annex.getState Annex.force) $
error "dropkey can cause data loss; use --force if you're sure you want to do this"
- showStart "dropkey" (key2file key)
+ showStart' "dropkey" key Nothing
next $ perform key
perform :: Key -> CommandPerform
diff --git a/Command/Get.hs b/Command/Get.hs
index fb2145fdd..edab72e42 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -16,7 +16,6 @@ import Config.NumCopies
import Annex.Wanted
import GitAnnex.Options
import qualified Command.Move
-import Types.Key
def :: [Command]
def = [withOptions getOptions $ command "get" paramPaths seek
@@ -51,7 +50,7 @@ start' expensivecheck from key afile = stopUnless (not <$> inAnnex key) $
go $ Command.Move.fromPerform src False key afile
where
go a = do
- showStart "get" (fromMaybe (key2file key) afile)
+ showStart' "get" key afile
next a
perform :: Key -> AssociatedFile -> CommandPerform
diff --git a/Command/Move.hs b/Command/Move.hs
index b7b567812..682fb5296 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -17,7 +17,6 @@ import Annex.UUID
import Logs.Presence
import Logs.Transfer
import GitAnnex.Options
-import Types.Key
def :: [Command]
def = [withOptions moveOptions $ command "move" paramPaths seek
@@ -54,10 +53,7 @@ start' to from move afile key = do
"--auto is not supported for move"
showMoveAction :: Bool -> Key -> AssociatedFile -> Annex ()
-showMoveAction True _ (Just file) = showStart "move" file
-showMoveAction False _ (Just file) = showStart "copy" file
-showMoveAction True key Nothing = showStart "move" (key2file key)
-showMoveAction False key Nothing = showStart "copy" (key2file key)
+showMoveAction move = showStart' (if move then "move" else "copy")
{- Moves (or copies) the content of an annexed file to a remote.
-
diff --git a/Command/Whereis.hs b/Command/Whereis.hs
index 0083f8c5c..723509fb1 100644
--- a/Command/Whereis.hs
+++ b/Command/Whereis.hs
@@ -14,7 +14,6 @@ import Command
import Remote
import Logs.Trust
import GitAnnex.Options
-import Types.Key
def :: [Command]
def = [noCommit $ withOptions (jsonOption : keyOptions) $
@@ -37,7 +36,7 @@ startKeys remotemap key = start' remotemap key Nothing
start' :: M.Map UUID Remote -> Key -> AssociatedFile -> CommandStart
start' remotemap key afile = do
- showStart "whereis" (fromMaybe (key2file key) afile)
+ showStart' "whereis" key afile
next $ perform remotemap key
perform :: M.Map UUID Remote -> Key -> CommandPerform