Sha256: c547830cacc79e0da9e06b723ab2c7acf8561a3ab4ea07ba8ad1f2c01a21218e
Contents?: true
Size: 1.62 KB
Versions: 6
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require_relative "../lib/cpl" commands_str_arr = [] commands = Command::Base.all_commands commands.keys.sort.each do |command_key| command_class = commands[command_key] next if command_class::HIDE name = command_class::NAME usage = command_class::USAGE.empty? ? name : command_class::USAGE options = command_class::OPTIONS long_description = command_class::LONG_DESCRIPTION examples = command_class::EXAMPLES command_str = "### `#{name}`\n\n" command_str += "#{long_description.strip}\n\n" if examples.empty? options_str_arr = [] options.each do |option| next unless option[:params][:required] options_str_arr.push("#{option[:params][:aliases][0]} $#{option[:params][:banner]}") end options_str = options_str_arr.join(" ") command_str += "```sh\ncpl #{usage}" command_str += " #{options_str}" unless options_str.empty? command_str += "\n```" else command_str += examples.strip end commands_str_arr.push(command_str) end commands_str = commands_str_arr.join("\n\n") commands_path = "#{__dir__}/../docs/commands.md" commands_data = <<~HEREDOC <!-- NOTE: This file is automatically generated by running `script/generate_commands_docs`. Do NOT edit it manually. --> ### Common Options ``` -a XXX, --app XXX app ref on Control Plane (GVC) ``` This `-a` option is used in most of the commands and will pick all other app configurations from the project-specific `.controlplane/controlplane.yml` file. ### Commands #{commands_str} HEREDOC File.binwrite(commands_path, commands_data)
Version data entries
6 entries across 6 versions & 1 rubygems