summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-04-16 15:11:51 -0700
committerTim Smith <tsmith@chef.io>2019-04-16 15:11:51 -0700
commite032b157d18fabaad979b2fe41779514996117f4 (patch)
tree8804e0ca48fb0824d9117675dce57a2076517288
parent28091136d32b5039b766b07800cb68c935f504f0 (diff)
downloadchef-kill_highline.tar.gz
Replace highline with tty-screen in knife listkill_highline
One step closer to killing off highline. We're just getting the terminal width here, which is super overkill for highline. We're still using it in quite a few other places, but this gets us one step closer to moving over to tty entirely. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--Gemfile.lock2
-rw-r--r--chef.gemspec1
-rw-r--r--lib/chef/knife/list.rb9
3 files changed, 10 insertions, 2 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 2c7595658e..d305c0a60c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -51,6 +51,7 @@ PATH
plist (~> 3.2)
proxifier (~> 1.0)
syslog-logger (~> 1.6)
+ tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
chef (15.0.216-universal-mingw32)
addressable
@@ -77,6 +78,7 @@ PATH
plist (~> 3.2)
proxifier (~> 1.0)
syslog-logger (~> 1.6)
+ tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
win32-api (~> 1.5.3)
win32-certstore (~> 0.3)
diff --git a/chef.gemspec b/chef.gemspec
index f6d8e93ab7..5fef206d64 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
s.add_dependency "net-ssh-multi", "~> 1.2", ">= 1.2.1"
s.add_dependency "net-sftp", "~> 2.1", ">= 2.1.2"
s.add_dependency "highline", "~> 1.6", ">= 1.6.9"
+ s.add_dependency "tty-screen", "~> 0.6" # knife list
s.add_dependency "erubis", "~> 2.7"
s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4"
s.add_dependency "ffi-libarchive"
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 5d95790a26..03954dcf00 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -25,30 +25,35 @@ class Chef
deps do
require "chef/chef_fs/file_system"
- require "highline"
+ require "tty-screen"
end
option :recursive,
short: "-R",
boolean: true,
description: "List directories recursively"
+
option :bare_directories,
short: "-d",
boolean: true,
description: "When directories match the pattern, do not show the directories' children"
+
option :local,
long: "--local",
boolean: true,
description: "List local directory instead of remote"
+
option :flat,
short: "-f",
long: "--flat",
boolean: true,
description: "Show a list of filenames rather than the prettified ls-like output normally produced"
+
option :one_column,
short: "-1",
boolean: true,
description: "Show only one column of results"
+
option :trailing_slashes,
short: "-p",
boolean: true,
@@ -143,7 +148,7 @@ class Chef
if config[:one_column] || !stdout.isatty
columns = 0
else
- columns = HighLine::SystemExtensions.terminal_size[0]
+ columns = TTY::Screen.columns
end
current_line = ""
results.each do |result|