bin/crowdin-cli in crowdin-cli-0.5.3 vs bin/crowdin-cli in crowdin-cli-0.5.4
- old
+ new
@@ -289,36 +289,35 @@
# Box-drawing character - https://en.wikipedia.org/wiki/Box-drawing_character
# ├ └ ─ │
#
def display_tree(files_tree, level = -2, branches = [])
- tab = ' ' * 4
level += 1
files_tree.each_with_index do |(key, val), index|
if val.empty? # this is a file
- result = branches.take(level).inject('') { |s, i| s << (i == 1 ? '│ ': ' ') }
+ result = branches.take(level).inject('') { |s, i| s << (i == 1 ? '│' : '').ljust(4) }
if index == files_tree.length - 1
# this is a last element
- result << '└' + '── ' + key
+ result << '└' + '──' + ' ' + key
else
- result << '├' + '── ' + key
+ result << '├' + '──' + ' ' + key
end
puts result
else # this is directory
if key == '' # root directory
result = '.'
else
- result = branches.take(level).inject('') { |s, i| s << (i == 1 ? '│ ' : ' ') }
+ result = branches.take(level).inject('') { |s, i| s << (i == 1 ? '│' : '').ljust(4) }
if index == files_tree.length - 1
# this is a last element
- result << '└' + '── ' + key
+ result << '└' + '──' + ' ' + key
branches[level] = 0
else
- result << '├' + '── ' + key
+ result << '├' + '──' + ' ' + key
branches[level] = 1
end
end
puts result