Class: Puppet::Application::Describe

Inherits:
Puppet::Application show all
Defined in:
lib/puppet/application/describe.rb

Constant Summary

Constants inherited from Puppet::Application

DOCPATTERN

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE

Constants included from Util::POSIX

Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS

Constants included from Util::SymbolicFileMode

Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit

Instance Attribute Summary

Attributes inherited from Puppet::Application

#command_line, #options

Instance Method Summary collapse

Methods inherited from Puppet::Application

[], #app_defaults, available_application_names, banner, clear!, clear?, clear_everything_for_tests, #configure_indirector_routes, controlled_run, #deprecate, #deprecated?, exit, find, #handle_logdest_arg, #handlearg, #initialize, #initialize_app_defaults, interrupted?, #log_runtime_environment, #name, option, option_parser_commands, #parse_options, restart!, restart_requested?, #run, #run_command, run_mode, #set_log_level, #setup_logs, stop!, stop_requested?, try_load_class

Methods included from Util

absolute_path?, benchmark, chuser, clear_environment, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, safe_posix_fork, set_env, symbolizehash, thinmark, uri_encode, uri_query_encode, uri_to_path, which, withenv, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::SymbolicFileMode

#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Constructor Details

This class inherits a constructor from Puppet::Application

Instance Method Details

#helpObject



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/puppet/application/describe.rb', line 185

def help
  <<-HELP

puppet-describe(8) -- #{summary}
========

SYNOPSIS
--------
Prints help about Puppet resource types, providers, and metaparameters.


USAGE
-----
puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta]


OPTIONS
-------
* --help:
Print this help text

* --providers:
Describe providers in detail for each type

* --list:
List all types

* --meta:
List all metaparameters

* --short:
List only parameters without detail


EXAMPLE
-------
  $ puppet describe --list
  $ puppet describe file --providers
  $ puppet describe user -s -m


AUTHOR
------
David Lutterkort


COPYRIGHT
---------
Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License

  HELP
end

#mainObject



242
243
244
245
246
247
248
249
250
# File 'lib/puppet/application/describe.rb', line 242

def main
  doc = TypeDoc.new

  if options[:list]
    doc.list_types
  else
    options[:types].each { |name| doc.format_type(name, options) }
  end
end

#preinitObject



238
239
240
# File 'lib/puppet/application/describe.rb', line 238

def preinit
  options[:parameters] = true
end

#setupObject



252
253
254
255
256
# File 'lib/puppet/application/describe.rb', line 252

def setup
  options[:types] = command_line.args.dup
  handle_help(nil) unless options[:list] || options[:types].size > 0
  $stderr.puts "Warning: ignoring types when listing all types" if options[:list] && options[:types].size > 0
end

#summaryObject



181
182
183
# File 'lib/puppet/application/describe.rb', line 181

def summary
  _("Display help about resource types")
end