以命令sbt "inspect tree clean"
为例。
这会将其输出(带..
)截断到终端的宽度,如果重定向到文件,则截断40个字符。
C:\dev>sbt "inspect tree clean"
[info] Loading project definition from C:\dev\project
[info] Set current project to dev (in build file:/C:/dev/)
[info] *:clean = Task[Unit]
[info] +-*:clean::streams = Task[sb..
[info] | +-*/*:streamsManager = Tas..
如何在没有任何截断的情况下打印整行?我在scala-sbt.org搜索了文档,但找不到任何相关内容。
我在Windows上使用sbt 0.13.8。
答案 0 :(得分:2)
相关部分是:
val defaultWidth = 40
val maxColumn = math.max(JLine.usingTerminal(_.getWidth), defaultWidth) - 8
因此,在交互模式下,您可以获得终端的宽度 - 8,在stdout中您可以获得32个字符。我没有看到它可配置的任何地方,所以最好的办法是在一个非常宽的终端窗口中运行它。 :)
编辑:正如我在评论中写的那样,我已经为SBT提交了一个PR,通过设置可以配置此值。现在,超过1年的等待,这个设置终于成为SBT 1.0的一部分。要增加输出宽度,可以在build.sbt中添加以下行:
asciiGraphWidth := <some big enough number>
或直接在SBT控制台中执行此命令:
set asciiGraphWidth := <some big enough number>
答案 1 :(得分:1)
在sbt 1.0.0或更新版本中,您可以运行:
def recursive_copy_files(source_path, destination_path, override=False):
"""
Recursive copies files from source to destination directory.
:param source_path: source directory
:param destination_path: destination directory
:param override if True all files will be overridden otherwise skip if file exist
:return: count of copied files
"""
files_count = 0
if not os.path.exists(destination_path):
os.mkdir(destination_path)
items = glob.glob(source_path + '/*')
for item in items:
if os.path.isdir(item):
path = os.path.join(destination_path, item.split('/')[-1])
files_count += recursive_copy_files(source_path=item, destination_path=path, override=override)
else:
file = os.path.join(destination_path, item.split('/')[-1])
if not os.path.exists(file) or override:
shutil.copyfile(item, file)
files_count += 1
return files_count