Some minor modifications (#60)

* remove unused dependencies

* add table indexes to help

* fix description

* fix placeholder

* reset selection

* fix structopt description

* add usage section

* add the way to add connections

* remove a space
pull/61/head
Takayuki Maeda 3 years ago committed by GitHub
parent f1bc32b057
commit be9a1c87ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

74
Cargo.lock generated

@ -122,12 +122,6 @@ dependencies = [
"wyz", "wyz",
] ]
[[package]]
name = "block"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.9.0" version = "0.9.0"
@ -235,28 +229,6 @@ dependencies = [
"vec_map", "vec_map",
] ]
[[package]]
name = "clipboard-win"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fdf5e01086b6be750428ba4a40619f847eb2e95756eee84b18e06e5f0b50342"
dependencies = [
"lazy-bytes-cast",
"winapi 0.3.9",
]
[[package]]
name = "copypasta"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4423d79fed83ebd9ab81ec21fa97144300a961782158287dc9bf7eddac37ff0b"
dependencies = [
"clipboard-win",
"objc",
"objc-foundation",
"objc_id",
]
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.1.5" version = "0.1.5"
@ -595,14 +567,12 @@ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
"clap", "clap",
"copypasta",
"crossterm 0.19.0", "crossterm 0.19.0",
"database-tree", "database-tree",
"dirs-next", "dirs-next",
"easy-cast", "easy-cast",
"futures", "futures",
"itertools", "itertools",
"regex",
"rust_decimal", "rust_decimal",
"serde", "serde",
"serde_json", "serde_json",
@ -748,12 +718,6 @@ dependencies = [
"winapi-build", "winapi-build",
] ]
[[package]]
name = "lazy-bytes-cast"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10257499f089cd156ad82d0a9cd57d9501fa2c989068992a97eb3c27836f206b"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -817,15 +781,6 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "malloc_buf"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "maplit" name = "maplit"
version = "1.0.2" version = "1.0.2"
@ -1045,35 +1000,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "objc"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
dependencies = [
"malloc_buf",
]
[[package]]
name = "objc-foundation"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
dependencies = [
"block",
"objc",
"objc_id",
]
[[package]]
name = "objc_id"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
dependencies = [
"objc",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.8.0" version = "1.8.0"

@ -7,7 +7,7 @@ license = "MIT"
homepage = "https://github.com/TaKO8Ki/gobang" homepage = "https://github.com/TaKO8Ki/gobang"
repository = "https://github.com/TaKO8Ki/gobang" repository = "https://github.com/TaKO8Ki/gobang"
readme = "README.md" readme = "README.md"
description = "A cross-platform terminal database tool written in Rust" description = "A cross-platform TUI database management tool written in Rust"
[workspace] [workspace]
members=[ members=[
@ -26,12 +26,10 @@ futures = "0.3.5"
serde_json = "1.0" serde_json = "1.0"
serde = "1.0" serde = "1.0"
toml = "0.4" toml = "0.4"
regex = "1"
strum = "0.21" strum = "0.21"
strum_macros = "0.21" strum_macros = "0.21"
database-tree = { path = "./database-tree", version = "0.1.0-alpha.1" } database-tree = { path = "./database-tree", version = "0.1.0-alpha.1" }
easy-cast = "0.4" easy-cast = "0.4"
copypasta = { version = "0.7.0", default-features = false }
async-trait = "0.1.50" async-trait = "0.1.50"
itertools = "0.10.0" itertools = "0.10.0"
rust_decimal = "1.15" rust_decimal = "1.15"

@ -4,7 +4,7 @@
gobang is currently in alpha gobang is currently in alpha
A cross-platform terminal database tool written in Rust A cross-platform TUI database management tool written in Rust
[![github workflow status](https://img.shields.io/github/workflow/status/TaKO8Ki/gobang/CI/main)](https://github.com/TaKO8Ki/gobang/actions) [![crates](https://img.shields.io/crates/v/gobang.svg?logo=rust)](https://crates.io/crates/gobang) [![github workflow status](https://img.shields.io/github/workflow/status/TaKO8Ki/gobang/CI/main)](https://github.com/TaKO8Ki/gobang/actions) [![crates](https://img.shields.io/crates/v/gobang.svg?logo=rust)](https://crates.io/crates/gobang)
@ -15,7 +15,7 @@ A cross-platform terminal database tool written in Rust
## Features ## Features
- Cross-platform support (macOS, Windows, Linux) - Cross-platform support (macOS, Windows, Linux)
- Multiple Database support (MySQL PostgreSQL, SQLite) - Multiple Database support (MySQL, PostgreSQL, SQLite)
- Intuitive keyboard only control - Intuitive keyboard only control
## TODOs ## TODOs
@ -34,6 +34,27 @@ If you already have a Rust environment set up, you can use the `cargo install` c
``` ```
$ cargo install --version 0.1.0-alpha.1 gobang $ cargo install --version 0.1.0-alpha.1 gobang
``` ```
## Usage
```
$ gobang
```
```
USAGE:
gobang [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config-path <config-path> Set the config file
```
If you want to add connections, you need to edit your config file. For more information, please see [Configuration](#Configuration).
## Keymap ## Keymap
| Key | Description | | Key | Description |

@ -1,7 +1,7 @@
use crate::config::CliConfig; use crate::config::CliConfig;
use structopt::StructOpt; use structopt::StructOpt;
/// A cross-platform terminal database tool written in Rust /// A cross-platform TUI database management tool written in Rust
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
#[structopt(name = "gobang")] #[structopt(name = "gobang")]
pub struct Cli { pub struct Cli {

@ -124,11 +124,12 @@ pub fn tab_indexes(key: &KeyConfig) -> CommandText {
pub fn toggle_tabs(key_config: &KeyConfig) -> CommandText { pub fn toggle_tabs(key_config: &KeyConfig) -> CommandText {
CommandText::new( CommandText::new(
format!( format!(
"Tab [{},{},{},{}]", "Tab [{},{},{},{},{}]",
key_config.tab_records, key_config.tab_records,
key_config.tab_columns, key_config.tab_columns,
key_config.tab_constraints, key_config.tab_constraints,
key_config.tab_foreign_keys key_config.tab_foreign_keys,
key_config.tab_indexes
), ),
CMD_GROUP_GENERAL, CMD_GROUP_GENERAL,
) )

@ -143,10 +143,10 @@ impl TableComponent {
if self.rows.is_empty() { if self.rows.is_empty() {
return; return;
} }
self.reset_selection();
if self.selected_column >= self.headers.len().saturating_sub(1) { if self.selected_column >= self.headers.len().saturating_sub(1) {
return; return;
} }
self.reset_selection();
self.selected_column += 1; self.selected_column += 1;
} }
@ -154,10 +154,10 @@ impl TableComponent {
if self.rows.is_empty() { if self.rows.is_empty() {
return; return;
} }
self.reset_selection();
if self.selected_column == 0 { if self.selected_column == 0 {
return; return;
} }
self.reset_selection();
self.selected_column -= 1; self.selected_column -= 1;
} }

@ -58,7 +58,7 @@ impl DrawableComponent for TableFilterComponent {
if focused || !self.input.is_empty() { if focused || !self.input.is_empty() {
self.input.iter().collect::<String>() self.input.iter().collect::<String>()
} else { } else {
"Enter a SQL expression in WHERE clause".to_string() "Enter a SQL expression in WHERE clause to filter records".to_string()
} }
)), )),
])) ]))

Loading…
Cancel
Save