From be9a1c87ec16d5e5759bdc577fc7b40168072a10 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda <41065217+TaKO8Ki@users.noreply.github.com> Date: Tue, 7 Sep 2021 00:41:44 +0900 Subject: [PATCH] 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 --- Cargo.lock | 74 ---------------------------------- Cargo.toml | 4 +- README.md | 25 +++++++++++- src/cli.rs | 2 +- src/components/command.rs | 5 ++- src/components/table.rs | 4 +- src/components/table_filter.rs | 2 +- 7 files changed, 31 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fa1191..3647bb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,12 +122,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - [[package]] name = "block-buffer" version = "0.9.0" @@ -235,28 +229,6 @@ dependencies = [ "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]] name = "cpufeatures" version = "0.1.5" @@ -595,14 +567,12 @@ dependencies = [ "async-trait", "chrono", "clap", - "copypasta", "crossterm 0.19.0", "database-tree", "dirs-next", "easy-cast", "futures", "itertools", - "regex", "rust_decimal", "serde", "serde_json", @@ -748,12 +718,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "lazy-bytes-cast" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10257499f089cd156ad82d0a9cd57d9501fa2c989068992a97eb3c27836f206b" - [[package]] name = "lazy_static" version = "1.4.0" @@ -817,15 +781,6 @@ dependencies = [ "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]] name = "maplit" version = "1.0.2" @@ -1045,35 +1000,6 @@ dependencies = [ "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]] name = "once_cell" version = "1.8.0" diff --git a/Cargo.toml b/Cargo.toml index 10f7ef7..b3be3cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" homepage = "https://github.com/TaKO8Ki/gobang" repository = "https://github.com/TaKO8Ki/gobang" 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] members=[ @@ -26,12 +26,10 @@ futures = "0.3.5" serde_json = "1.0" serde = "1.0" toml = "0.4" -regex = "1" strum = "0.21" strum_macros = "0.21" database-tree = { path = "./database-tree", version = "0.1.0-alpha.1" } easy-cast = "0.4" -copypasta = { version = "0.7.0", default-features = false } async-trait = "0.1.50" itertools = "0.10.0" rust_decimal = "1.15" diff --git a/README.md b/README.md index f145f7b..b9cc7ed 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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) @@ -15,7 +15,7 @@ A cross-platform terminal database tool written in Rust ## Features - Cross-platform support (macOS, Windows, Linux) -- Multiple Database support (MySQL PostgreSQL, SQLite) +- Multiple Database support (MySQL, PostgreSQL, SQLite) - Intuitive keyboard only control ## 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 ``` + +## Usage + +``` +$ gobang +``` + +``` +USAGE: + gobang [OPTIONS] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + -c, --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 | Key | Description | diff --git a/src/cli.rs b/src/cli.rs index 5c1fc7d..37d0db0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,7 +1,7 @@ use crate::config::CliConfig; 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)] #[structopt(name = "gobang")] pub struct Cli { diff --git a/src/components/command.rs b/src/components/command.rs index cc13d7a..54bdf11 100644 --- a/src/components/command.rs +++ b/src/components/command.rs @@ -124,11 +124,12 @@ pub fn tab_indexes(key: &KeyConfig) -> CommandText { pub fn toggle_tabs(key_config: &KeyConfig) -> CommandText { CommandText::new( format!( - "Tab [{},{},{},{}]", + "Tab [{},{},{},{},{}]", key_config.tab_records, key_config.tab_columns, key_config.tab_constraints, - key_config.tab_foreign_keys + key_config.tab_foreign_keys, + key_config.tab_indexes ), CMD_GROUP_GENERAL, ) diff --git a/src/components/table.rs b/src/components/table.rs index abf7914..d2d1688 100644 --- a/src/components/table.rs +++ b/src/components/table.rs @@ -143,10 +143,10 @@ impl TableComponent { if self.rows.is_empty() { return; } + self.reset_selection(); if self.selected_column >= self.headers.len().saturating_sub(1) { return; } - self.reset_selection(); self.selected_column += 1; } @@ -154,10 +154,10 @@ impl TableComponent { if self.rows.is_empty() { return; } + self.reset_selection(); if self.selected_column == 0 { return; } - self.reset_selection(); self.selected_column -= 1; } diff --git a/src/components/table_filter.rs b/src/components/table_filter.rs index e91932a..001038c 100644 --- a/src/components/table_filter.rs +++ b/src/components/table_filter.rs @@ -58,7 +58,7 @@ impl DrawableComponent for TableFilterComponent { if focused || !self.input.is_empty() { self.input.iter().collect::() } else { - "Enter a SQL expression in WHERE clause".to_string() + "Enter a SQL expression in WHERE clause to filter records".to_string() } )), ]))