public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox 1/1] proxmox/api/cli: add extract_output_format
Date: Mon, 3 May 2021 09:03:55 +0200	[thread overview]
Message-ID: <d10c2399-9cf3-ea9a-dc59-81f4c20b90dd@proxmox.com> (raw)
In-Reply-To: <20210430125156.20072-2-d.csapak@proxmox.com>

applied

On 4/30/21 2:51 PM, Dominik Csapak wrote:
> just getting it is not enough, sometimes we want it to remove from
> params (if possble) too
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>   proxmox/src/api/cli/text_table.rs | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/proxmox/src/api/cli/text_table.rs b/proxmox/src/api/cli/text_table.rs
> index 5ff2db0..84d9f34 100644
> --- a/proxmox/src/api/cli/text_table.rs
> +++ b/proxmox/src/api/cli/text_table.rs
> @@ -25,6 +25,18 @@ pub fn get_output_format(param: &Value) -> String {
>       output_format.unwrap_or_else(|| String::from("text"))
>   }
>   
> +/// Helper to get output format from parameters or environment
> +/// and removing from parameters
> +pub fn extract_output_format(param: &mut Value) -> String {
> +    let output_format = get_output_format(param);
> +
> +    if let Some(param) = param.as_object_mut() {
> +        param.remove("output-format");
> +    }
> +
> +    output_format
> +}
> +
>   /// Helper to get TableFormatOptions with default from environment
>   pub fn default_table_format_options() -> TableFormatOptions {
>       let no_border = std::env::var(ENV_VAR_PROXMOX_OUTPUT_NO_BORDER)




  reply	other threads:[~2021-05-03  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 12:51 [pbs-devel] [PATCH proxmox/proxmox-backup] fix some proxmox-tape calls Dominik Csapak
2021-04-30 12:51 ` [pbs-devel] [PATCH proxmox 1/1] proxmox/api/cli: add extract_output_format Dominik Csapak
2021-05-03  7:03   ` Dietmar Maurer [this message]
2021-04-30 12:51 ` [pbs-devel] [PATCH proxmox-backup 1/1] bin: use extract_output_format where necessary Dominik Csapak
2021-05-03  7:04   ` [pbs-devel] applied: " Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d10c2399-9cf3-ea9a-dc59-81f4c20b90dd@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal