Module: GreenHat::Shell::Cat
- Defined in:
- lib/greenhat/shell/cat.rb
Overview
Common File Reader File
Class Method Summary collapse
-
.default(raw) ⇒ Object
Default ========================================================================.
- .help ⇒ Object
- .ls(args = []) ⇒ Object
-
.show(raw) ⇒ Object
Show Attempted Formatting ========================================================================.
Class Method Details
.default(raw) ⇒ Object
Default
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/greenhat/shell/cat.rb', line 32 def self.default(raw) # Extract Args files_list, flags, _args = Args.parse(raw) # Collect Files files = ShellHelper.files(files_list, Thing.all, flags) results = ShellHelper.file_process(files) do |file| [ file.friendly_name, file.output(false), "\n" ] end ShellHelper.show(results.flatten, flags) end |
.help ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/greenhat/shell/cat.rb', line 6 def self.help puts "\u2500".pastel(:cyan) * 20 puts "#{'Cat'.pastel(:yellow)} All the files" puts "\u2500".pastel(:cyan) * 20 puts 'Print raw file by just entering the file name' puts ShellHelper.common_opts puts 'Commands'.pastel(:blue) puts ShellHelper::List.help puts ' <file names+>'.pastel(:green) puts ' Print any file names' puts ' Ex: `free_m`' puts ' Ex: `ps mount --raw`' puts puts " #{'show'.pastel(:green)} <file names>" puts ' Attempt to print formatted output' puts ' Ex: show `free_m`' end |
.ls(args = []) ⇒ Object
71 72 73 |
# File 'lib/greenhat/shell/cat.rb', line 71 def self.ls(args = []) ShellHelper::List.list(args, Thing.all) end |
.show(raw) ⇒ Object
Show Attempted Formatting
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/greenhat/shell/cat.rb', line 53 def self.show(raw) # Extract Args files_list, flags, _args = Args.parse(raw) # Collect Files files = ShellHelper.files(files_list, Thing.all, flags) results = ShellHelper.file_process(files) do |file| [ file.friendly_name, file.data, "\n" ] end ShellHelper.show(results.flatten, flags) end |