mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 23:10:24 +01:00
* imp: refactor import message * import: reword error message Signed-off-by: Ruslan Kuprieiev <[email protected]>
25 lines
688 B
Python
25 lines
688 B
Python
import os
|
|
|
|
import dvc.logger as logger
|
|
from dvc.utils.compat import urlparse
|
|
from dvc.exceptions import DvcException
|
|
from dvc.command.base import CmdBase
|
|
|
|
|
|
class CmdImport(CmdBase):
|
|
def run(self):
|
|
try:
|
|
default_out = os.path.basename(
|
|
urlparse(self.args.url).path
|
|
)
|
|
|
|
out = self.args.out or default_out
|
|
|
|
self.project.imp(self.args.url, out)
|
|
except DvcException:
|
|
logger.error('failed to import {}. You could also try downloading '
|
|
'it manually and adding it with `dvc add` command.'
|
|
.format(self.args.url))
|
|
return 1
|
|
return 0
|