class Dotfiler::CLI::Commands::List
Public Instance Methods
call(names: nil)
click to toggle source
# File lib/dotfiler/cli/commands/list.rb, line 11 def call(names: nil) handle_errors do if dotfiles.list.empty? terminate!(:info, message: "No dotfiles are managed at the moment") else content = generate_list(names_only: !names.nil?) shell.print(content) end end end
Private Instance Methods
generate_list(names_only: false)
click to toggle source
# File lib/dotfiler/cli/commands/list.rb, line 24 def generate_list(names_only: false) content = "" dotfiles.each do |dotfile| name, link, path = dotfile.to_h.values_at(:name, :link, :path) content += " #{name}\n" if !names_only content += " - LINK: #{link}\n" content += " - PATH: #{path}\n\n" end end content end