66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/inspec/shell.rb', line 66
def help(resource = nil)
if resource.nil?
ctx = @runner.backend
puts "\nAvailable commands:\n\n`[resource]` - run resource on target machine\n`help resources` - show all available resources that can be used as commands\n`help [resource]` - information about a specific resource\n`exit` - exit the InSpec shell\n\nYou can use resources in this environment to test the target machine. For example:\n\ncommand('uname -a').stdout\nfile('/proc/cpuinfo').content => \"value\",\n\nYou are currently running on:\n\nOS family: \#{mark ctx.os[:family] || 'unknown'}\nOS release: \#{mark ctx.os[:release] || 'unknown'}\n\n"
elsif resource == 'resources'
resources
elsif !Inspec::Resource.registry[resource].nil?
puts "\#{mark 'Name:'} \#{resource}\n\n\#{mark 'Description:'}\n\n\#{Inspec::Resource.registry[resource].desc}\n\n\#{mark 'Example:'}\n\#{print_example(Inspec::Resource.registry[resource].example)}\n\n\#{mark 'Web Reference:'}\n\nhttps://github.com/chef/inspec/blob/master/docs/resources.rst#\#{resource}\n\n"
else
puts 'Only the following resources are available:'
resources
end
end
|