X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FCLIHandler.pm;h=73e8ee632fc9cd204d5db0a2532e1acfa3226d28;hp=33c47c3d108483672533ced1c5e29acdf52770f1;hb=3ef20687db9cda54dbb3a02ac3b911a87657efc0;hpb=7b7f99c9b9d2807e6e1c387f9dfcef35655e5761 diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 33c47c3..73e8ee6 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -2,7 +2,6 @@ package PVE::CLIHandler; use strict; use warnings; -use Data::Dumper; use PVE::SafeSyslog; use PVE::Exception qw(raise raise_param_exc); @@ -49,12 +48,12 @@ my $complete_command_names = sub { }; __PACKAGE__->register_method ({ - name => 'help', + name => 'help', path => 'help', method => 'GET', description => "Get help about specified command.", parameters => { - additionalProperties => 0, + additionalProperties => 0, properties => { cmd => { description => "Command name", @@ -70,7 +69,7 @@ __PACKAGE__->register_method ({ }, }, returns => { type => 'null' }, - + code => sub { my ($param) = @_; @@ -84,7 +83,7 @@ __PACKAGE__->register_method ({ if (!$cmd) { if ($verbose) { print_usage_verbose(); - } else { + } else { print_usage_short(\*STDOUT); } return undef; @@ -311,7 +310,7 @@ sub verify_api { my $get_exe_name = sub { my ($class) = @_; - + my $name = $class; $name =~ s/^.*:://; $name =~ s/_/-/g; @@ -338,29 +337,6 @@ complete -o default -C '$exename bashcomplete' $exename __EOD__ } -sub find_cli_class_source { - my ($name) = @_; - - my $filename; - - $name =~ s/-/_/g; - - my $cpath = "PVE/CLI/${name}.pm"; - my $spath = "PVE/Service/${name}.pm"; - foreach my $p (@INC) { - foreach my $s (($cpath, $spath)) { - my $testfn = "$p/$s"; - if (-f $testfn) { - $filename = $testfn; - last; - } - } - last if defined($filename); - } - - return $filename; -} - sub generate_asciidoc_synopsys { my ($class) = @_; $class->generate_asciidoc_synopsis(); @@ -506,10 +482,6 @@ sub run_cli_handler { initlog($exename); - if ($class !~ m/^PVE::Service::/) { - die "please run as root\n" if $> != 0; - } - no strict 'refs'; my $def = ${"${class}::cmddef"};