From dbf02b953066cd95ad8c4d70dfdee3daab96d9e5 Mon Sep 17 00:00:00 2001 From: Fred Snyder Date: Sun, 5 Nov 2023 08:03:39 -0500 Subject: [PATCH] List command --- lib/solargraph/shell.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/solargraph/shell.rb b/lib/solargraph/shell.rb index b7949f01d..0ae7934b6 100755 --- a/lib/solargraph/shell.rb +++ b/lib/solargraph/shell.rb @@ -194,6 +194,17 @@ def scan puts "Scanned #{directory} (#{api_map.pins.length} pins) in #{time.real} seconds." end + desc 'list', 'List the files in the workspace and the total count' + option :count, type: :boolean, aliases: :c, desc: 'Display the file count only', default: false + option :directory, type: :string, aliases: :d, desc: 'The directory to read', default: '.' + def list + workspace = Solargraph::Workspace.new(options[:directory]) + unless options[:count] + workspace.filenames.each { |f| puts f } + end + puts "#{workspace.filenames.length} files total." + end + desc 'bundle', 'Generate documentation for bundled gems [deprecated]' long_desc %( The `bundle` command is deprecated. Solargraph currently uses RBS instead.