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::ALNUM, Util::ALPHA, Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE, Util::ESCAPED, Util::HEX, Util::HttpProxy, Util::PUPPET_STACK_INSERTION_FRAME, Util::RESERVED, Util::RFC_3986_URI_REGEX, Util::UNRESERVED, Util::UNSAFE

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?, environment_mode, exit, find, get_environment_mode, #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, create_erb, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, format_backtrace_array, format_puppetstack_frame, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, resolve_stackframe, rfc2396_escape, safe_posix_fork, set_env, skip_external_facts, symbolizehash, thinmark, uri_encode, uri_query_encode, uri_to_path, uri_unescape, which, withenv, withumask

Methods included from Util::POSIX

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

Methods included from Util::SymbolicFileMode

#display_mode, #normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Constructor Details

This class inherits a constructor from Puppet::Application

Instance Method Details

#helpObject



180
181
182
183
184
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
# File 'lib/puppet/application/describe.rb', line 180

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



237
238
239
240
241
242
243
244
245
# File 'lib/puppet/application/describe.rb', line 237

def main
  doc = TypeDoc.new

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

#preinitObject



233
234
235
# File 'lib/puppet/application/describe.rb', line 233

def preinit
  options[:parameters] = true
end

#setupObject



247
248
249
250
251
# File 'lib/puppet/application/describe.rb', line 247

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



176
177
178
# File 'lib/puppet/application/describe.rb', line 176

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