from dvc.command.common.base import CmdBase
from dvc.logger import Logger

import dvc.data_cloud as cloud


class CmdDataPull(CmdBase):
    def __init__(self, settings):
        super(CmdDataPull, self).__init__(settings)

    def run(self):
        self.cloud.pull(self.parsed_args.targets, self.parsed_args.jobs)


class CmdDataPush(CmdBase):
    def __init__(self, settings):
        super(CmdDataPush, self).__init__(settings)

    def run(self):
        self.cloud.push(self.parsed_args.targets, self.parsed_args.jobs)


class CmdDataStatus(CmdBase):
    def __init__(self, settings):
        super(CmdDataStatus, self).__init__(settings)

    def _show(self, status):
        for s in status:
            target, ret = s

            if ret == cloud.STATUS_UNKNOWN or ret == cloud.STATUS_OK:
                continue

            prefix_map = {
                cloud.STATUS_DELETED  : 'deleted: ',
                cloud.STATUS_MODIFIED : 'modified:',
                cloud.STATUS_NEW      : 'new file:',
            }

            Logger.info('\t{}\t{}'.format(prefix_map[ret], target.data.dvc))

    def run(self):
        status = self.cloud.status(self.parsed_args.targets, self.parsed_args.jobs)
        self._show(status)
        return 0

@@ -100,17 +100,16 @@
  cloud%0A%0A
-%0A
 class Cm
@@ -113,20 +113,20 @@
  CmdData
-Pull
+Base
 (CmdBase
@@ -151,32 +151,37 @@
 _(self, settings
+, cmd
 ):%0A        super
@@ -192,12 +192,12 @@
 Data
-Pull
+Base
 , se
@@ -210,32 +210,55 @@
 init__(settings)
+%0A        self.cmd = cmd
 %0A%0A    def run(se
@@ -262,32 +262,40 @@
 (self):%0A        
+getattr(
 self.cloud.pull(
@@ -292,13 +292,19 @@
 loud
-.pull
+, self.cmd)
 (sel
@@ -370,14 +370,18 @@
 taPu
-sh
+ll
 (Cmd
+Data
 Base
@@ -440,18 +440,18 @@
 mdDataPu
-sh
+ll
 , self).
@@ -471,101 +471,144 @@
 ings
-)%0A%0A    def run(self):%0A        self.cloud.push(self.parsed_args.targets, self.parsed_args.jobs
+, 'pull')%0A%0A%0Aclass CmdDataPush(CmdDataBase):%0A    def __init__(self, settings):%0A        super(CmdDataPush, self).__init__(settings, 'push'
 )%0A%0A%0A

generalize CmdDataBase class