110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/inspec/shell.rb', line 110
def help(resource = nil)
if resource.nil?
puts <<EOF
Available commands:
`[resource]` - run resource on target machine
`help resources` - show all available resources that can be used as commands
`help [resource]` - information about a specific resource
`exit` - exit the InSpec shell
You can use resources in this environment to test the target machine. For example:
command('uname -a').stdout
file('/proc/cpuinfo').content => "value"
#{print_target_info}
EOF
elsif resource == 'resources'
resources
elsif !Inspec::Resource.registry[resource].nil?
puts <<EOF
#{mark 'Name:'} #{resource}
#{mark 'Description:'}
#{Inspec::Resource.registry[resource].desc}
#{mark 'Example:'}
#{print_example(Inspec::Resource.registry[resource].example)}
#{mark 'Web Reference:'}
https://github.com/chef/inspec/blob/master/docs/resources.rst##{resource}
EOF
else
puts 'Only the following resources are available:'
resources
end
end
|