Upgrading clap version to 4.x for skysh (#284)
parent
f41ea72747
commit
54d2075a6d
@ -1,9 +1,18 @@
|
|||||||
# Skytable Shell
|
# Skytable Shell
|
||||||
|
|
||||||
This directory contains the source code for the Skytable Shell. When compiled, it produces a single binary `skysh`, short for **Sky**table **s**hell. The Skytable shell can be used to connect to a Skytable instance and it provides some nice to have shell features like history, terminal interactions and more.
|
This directory contains the source code for the Skytable Shell. When compiled, it produces a single binary `skysh`, short for **Sky**table **s**hell. The Skytable shell can be used to connect to a Skytable instance, and it provides some nice to have shell features like history, terminal interactions and more.
|
||||||
|
|
||||||
By default, `skysh` connects to the `default:default` entity for an instance running on `127.0.0.1` (localhost) on port `2003`. You can change these connection settings use command-line parameters.
|
By default, `skysh` connects to the `default:default` entity for an instance running on `127.0.0.1` (localhost) on port `2003`. You can change these connection settings use command-line parameters.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
The below terminal interactions show a few ways in which `skysh` can be used:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Use skysh to run one-off expressions
|
||||||
|
skysh -e "SET x 100" "GET x"
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
All files in this directory are distributed under the [AGPL-3.0 License](../LICENSE).
|
All files in this directory are distributed under the [AGPL-3.0 License](../LICENSE).
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
use clap::Parser;
|
||||||
|
use clap::ArgAction;
|
||||||
|
|
||||||
|
const HELP_TEMPLATE: &'static str = r#"
|
||||||
|
{before-help}{name} {version}
|
||||||
|
{author-with-newline}{about-with-newline}
|
||||||
|
{usage-heading} {usage}
|
||||||
|
|
||||||
|
{all-args}{after-help}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[command(author, version, about, long_about=None, disable_help_flag=true, help_template=HELP_TEMPLATE)]
|
||||||
|
pub struct Cli {
|
||||||
|
#[arg(short = 'C', long = "sslcert", help="Sets the PEM certificate to use for SSL connections", value_name = "CERT")]
|
||||||
|
pub ssl_cert: Option<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'e', long = "eval", help = "Run one or more expressions without REPL", value_name = "EXPRESSION", num_args=0..)]
|
||||||
|
pub expressions: Option<Vec<String>>,
|
||||||
|
|
||||||
|
#[arg(short, long, help = "Sets the remote host to connect to", default_value = "127.0.0.1", value_name = "HOST")]
|
||||||
|
pub host: String,
|
||||||
|
|
||||||
|
#[arg(short, long, help = "Sets the remote port to connect to", default_value_t = 2003, value_name = "PORT")]
|
||||||
|
pub port: u16,
|
||||||
|
|
||||||
|
#[arg(long, help="Print help information", action=ArgAction::Help)]
|
||||||
|
pub help: Option<bool>
|
||||||
|
}
|
@ -1,55 +0,0 @@
|
|||||||
#
|
|
||||||
# Created on Tue Nov 03 2020
|
|
||||||
#
|
|
||||||
# This file is a part of Skytable
|
|
||||||
# Copyright (c) 2020, Sayan Nandan <ohsayan@outlook.com>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Skytable Shell
|
|
||||||
version: 0.8.0
|
|
||||||
author: Sayan N. <ohsayan@outlook.com>
|
|
||||||
about: The Skytable Shell (skysh)
|
|
||||||
args:
|
|
||||||
- host:
|
|
||||||
short: h
|
|
||||||
required: false
|
|
||||||
long: host
|
|
||||||
value_name: host
|
|
||||||
help: Sets the remote host to connect to
|
|
||||||
takes_value: true
|
|
||||||
- port:
|
|
||||||
short: p
|
|
||||||
required: false
|
|
||||||
long: port
|
|
||||||
value_name: port
|
|
||||||
help: Sets the remote port to connect to
|
|
||||||
takes_value: true
|
|
||||||
- eval:
|
|
||||||
short: e
|
|
||||||
required: false
|
|
||||||
long: eval
|
|
||||||
multiple: true
|
|
||||||
value_name: expression
|
|
||||||
help: Run an expression without REPL
|
|
||||||
takes_value: true
|
|
||||||
- cert:
|
|
||||||
short: C
|
|
||||||
required: false
|
|
||||||
long: sslcert
|
|
||||||
value_name: cert
|
|
||||||
help: Sets the PEM certificate to use for SSL connections
|
|
||||||
takes_value: true
|
|
Loading…
Reference in New Issue