From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 21189631EB for ; Wed, 15 Jul 2020 12:21:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 15C9C2E670 for ; Wed, 15 Jul 2020 12:21:20 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 44FD72E665 for ; Wed, 15 Jul 2020 12:21:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0574A43151 for ; Wed, 15 Jul 2020 12:21:19 +0200 (CEST) Date: Wed, 15 Jul 2020 12:21:17 +0200 From: Wolfgang Bumiller To: Dominik Csapak Cc: pbs-devel@lists.proxmox.com Message-ID: <20200715102117.ordmd7e5wgfvkbln@olga.proxmox.com> References: <20200715094042.21092-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200715094042.21092-1-d.csapak@proxmox.com> User-Agent: NeoMutt/20180716 X-SPAM-LEVEL: Spam detection results: 0 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [pbs-devel] applied: [PATCH proxmox-backup] catalog_shell: add exit command X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2020 10:21:20 -0000 applied On Wed, Jul 15, 2020 at 11:40:42AM +0200, Dominik Csapak wrote: > it is nice to have a command to exit from the shell instead of > only allowing ctrl+d or ctrl+c > > the api method is just for documentation/help purposes and does nothing > by itself, the real logic is directly in the read loop > > Signed-off-by: Dominik Csapak > --- > src/backup/catalog_shell.rs | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/src/backup/catalog_shell.rs b/src/backup/catalog_shell.rs > index d59f738..99552cd 100644 > --- a/src/backup/catalog_shell.rs > +++ b/src/backup/catalog_shell.rs > @@ -89,6 +89,10 @@ pub fn catalog_shell_cli() -> CommandLineInterface { > "find", > CliCommand::new(&API_METHOD_FIND_COMMAND).arg_param(&["pattern"]), > ) > + .insert( > + "exit", > + CliCommand::new(&API_METHOD_EXIT), > + ) > .insert_help(), > ) > } > @@ -104,6 +108,14 @@ fn complete_path(complete_me: &str, _map: &HashMap) -> Vec } > } > > +// just an empty wrapper so that it is displayed in help/docs, we check > +// in the readloop for 'exit' again break > +#[api(input: { properties: {} })] > +/// Exit the shell > +async fn exit() -> Result<(), Error> { > + Ok(()) > +} > + > #[api(input: { properties: {} })] > /// List the current working directory. > async fn pwd_command() -> Result<(), Error> { > @@ -439,6 +451,9 @@ impl Shell { > SHELL = Some(this as *mut Shell as usize); > } > while let Ok(line) = this.rl.readline(&this.prompt) { > + if line == "exit" { > + break; > + } > let helper = this.rl.helper().unwrap(); > let args = match cli::shellword_split(&line) { > Ok(args) => args, > -- > 2.20.1 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel