ct create: Listing available templates via ct create -l

This commit is contained in:
Denis Knauf 2021-06-07 13:54:54 +02:00
parent f816ac3bc2
commit 1ff6ee163a

View file

@ -57,7 +57,11 @@ def cli_ct
if %w[-h --help].include? template if %w[-h --help].include? template
STDERR.puts "Usage: ct create TEMPLATE -h # Shows template-related options" STDERR.puts "Usage: ct create TEMPLATE -h # Shows template-related options"
STDERR.puts " ct create TEMPLATE [OPTIONS] # Creates a container" STDERR.puts " ct create TEMPLATE [OPTIONS] # Creates a container"
STDERR.puts " ct create -l # Listing available templates"
exit 1 exit 1
elsif %w[-l --list].include? template
STDERR.puts PVE::CTTemplate.constants.reject {|c|:Base==c}.map {|c|c.to_s.titlecase.dasherize.downcase}
exit 0
end end
ctopts = {} ctopts = {}
OptionParser.new do |opts| OptionParser.new do |opts|