IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
instead of writing:
['name', sub {...}, 'description', 1]
one can now use:
{
name => 'name',
func => sub { ... },
desc => 'desc',
interactive => 1,
}
which makes it more obvious what is what
(and allows later patches to easily override some things)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
print_api_list takes an array of columns to print, the data, and the returns
definitions of the API, and prints the data by using print_text_table.
handle_cmd and handle_simple_cmd call the output sub with the returns definitons.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
These two function could serve as a generic output sub for various CLI
utilities
* print_text_table prints an array of objects in a tabular fashion,
the formating is passed as an array containg hashes with titles, maximal
lengths and default values. This way we can stay extensible, by adding other
keys to the formatting options
* print_entry prints out a single entry, handling array-refs as properties
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
remove the cleanup of the not produced ${PACKAGE}-*.tar.gz file.
This is here since the import from SVN, but is not needed since quite
a time.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
the used ones are in src/Makefile, so remove those left over, else
one could get confused why there on two places and why changes here
had no effect.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
we do not complete them in bash copletion either and their just there
for backward compatibillity, so filter them out.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
followup for previous commit to show the full short usage string for
the CLI tool in the case of an unknown command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Allow to return the original tree with all refs. We use this
with our new pveclient which needs the full api definition.
Keeping refs makes it possible to store the tree more efficiently.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This contains 2 functional changes:
First: resolve_cmd no longer keeps a hash of which arguments
were expanded. This information is not required and not used
properly: For one it would conflict if the same word
appeared twice in a longer subcommand, and secondly we lose
the information when recursing into an alias anyway. And
lastly, we do not support tab completing multiple parameters
simultaneously anyway (as in, `pveum u a<tab>` does not
become `pveum user add`).
So now we simply return the expanded version of the last
command or undef if it was unknown in place of the hash we
returned previously.
The second change is how we use the new returned value:
Previously if resolve_cmd() returned a new subcommand in
$def we skipped over finishing the last word. Of course, if
the command was already fully specified (but no space put
after it), we already considered it complete and returned
the new $def.
This condition can be detected as in this case the $prev
command equals the $cur command. (Additionally, the $cur
command is either '' (after the space) or also the $prev
command (before the space), but checking this would only be
required when the same word can actually appear multiple
times in a row in a sub command chain...)
This case now takes precedence over looking through the
nested $def, so that bash will put the space after a full
command which requires another subcommand to be added.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
We cannot properly encode blessed objects as json, so
instead, we should stringify them. This happened for
instance if a VM's systemd scope wasn't cleaned up as we
got an error as a Net::DBus::Error object causing a
"malformed json string" error to appear instead of the
actual message.
Additionally, add a 'must_stringify' helper: The above error
object implements a '""' operator for stringification (as
all error should), but in theory that could die as well, in
which case we just return a generic error string we'll
hopefully never see...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Not only because <=> is correct, but using 'cmp' also has
the side effect that it adds a string version to the
variable and the API's json output turns into a string as
well, and this only happens once a task has completed
(while it's an integer while it's still running...)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>