From 1ff6ee163a89cef806e7052123a26dd5b3f76aa8 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Mon, 7 Jun 2021 13:54:54 +0200 Subject: [PATCH] ct create: Listing available templates via `ct create -l` --- lib/pve/cli/ct.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pve/cli/ct.rb b/lib/pve/cli/ct.rb index 61aca3c..bee83c0 100644 --- a/lib/pve/cli/ct.rb +++ b/lib/pve/cli/ct.rb @@ -57,7 +57,11 @@ def cli_ct if %w[-h --help].include? template STDERR.puts "Usage: ct create TEMPLATE -h # Shows template-related options" STDERR.puts " ct create TEMPLATE [OPTIONS] # Creates a container" + STDERR.puts " ct create -l # Listing available templates" 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 ctopts = {} OptionParser.new do |opts|