Module: GreenHat::Shell::Process
- Defined in:
- lib/greenhat/shell/process.rb
Overview
Logs
Class Method Summary collapse
- .default(raw_list) ⇒ Object
- .filter(raw = {}) ⇒ Object
- .filter_help(raw = {}) ⇒ Object
- .help ⇒ Object
-
.ls ⇒ Object
Easy Show All Filter –archive.
- .ps(raw = {}) ⇒ Object
Class Method Details
.default(raw_list) ⇒ Object
50 51 52 |
# File 'lib/greenhat/shell/process.rb', line 50 def self.default(raw_list) filter(raw_list) end |
.filter(raw = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/greenhat/shell/process.rb', line 54 def self.filter(raw = {}) # Argument Parsing files, flags, args = Args.parse(raw) # Prepare Log List file_list = ShellHelper.prepare_list(files, GreenHat::Ps.things) results = Query.start(file_list, flags, args) # Check Search Results if results.instance_of?(Hash) && results.values.flatten.empty? puts 'No results'.pastel(:red) else ShellHelper.show(results, flags) end end |
.filter_help(raw = {}) ⇒ Object
33 34 35 36 37 |
# File 'lib/greenhat/shell/process.rb', line 33 def self.filter_help(raw = {}) args, flags, _args = Args.parse(raw) ShellHelper.show(ShellHelper::Filter.help(args.first), flags) end |
.help ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/greenhat/shell/process.rb', line 13 def self.help puts "\u2500".pastel(:cyan) * 22 puts "#{'Process'.pastel(:yellow)} - ps helper" puts "\u2500".pastel(:cyan) * 22 ShellHelper.common_opts puts 'Command Summary'.pastel(:blue) puts ' ps'.pastel(:green) puts ' Raw `ps`' puts puts ' filter'.pastel(:green) puts " Key/Field Filtering. See #{'filter_help'.pastel(:blue)}" puts ' Examples' puts ' filter --sort=mem --reverse'.pastel(:green) puts ' filter --user=gitlab'.pastel(:green) puts end |
.ls ⇒ Object
Easy Show All Filter –archive
9 10 11 |
# File 'lib/greenhat/shell/process.rb', line 9 def self.ls help end |
.ps(raw = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/greenhat/shell/process.rb', line 39 def self.ps(raw = {}) # Extract Args files_list, flags, _args = Args.parse(raw) # Collect Files files = ShellHelper.files(files_list, GreenHat::Ps.things, flags) # Output ShellHelper.file_output(files, flags) end |