dbcli / litecli

CLI for SQLite Databases with auto-completion and syntax highlighting
https://litecli.com
BSD 3-Clause "New" or "Revised" License
2.09k stars 68 forks source link

\f prompt format string for database basename #107

Closed elig0n closed 3 years ago

elig0n commented 3 years ago

Description

The prompt format string \d (which is also the default) is replaced with the full path to the open database, even when the database file is in the current directory.

The Problem

This can get long sometimes and make the prompt input line shortened very much, especially on small terminals. Some users might desire to display the shortened base-name version of the database for convenience.

Suggested Solution

Hence, I've added the option \f for showing only the basename. Otherwise, a relative-path sensitivity for the \d format string should be implemented.

Checklist

codecov-io commented 3 years ago

Codecov Report

Merging #107 (098d40a) into master (93c7a3b) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   62.32%   62.34%   +0.01%     
==========================================
  Files          23       23              
  Lines        1935     1936       +1     
==========================================
+ Hits         1206     1207       +1     
  Misses        729      729              
Impacted Files Coverage Δ
litecli/main.py 48.13% <100.00%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 93c7a3b...098d40a. Read the comment docs.

zzl0 commented 3 years ago

@elig0n Thanks for your PR. Yeah, it makes more sense to show a shorter basename than the full file path.

SQLite is different than other databases, we probably need to rethink about the database names in SQLite and related commands (e.g. use).

For now, I would prefer:

  1. Keep \d - Database name the same as before .
  2. Change \f to \f - File basename of the "main" database.

Let me know what you think.

zzl0 commented 3 years ago

I forgot check the CHANGELOG.md. Could you add this change to CHANGELOG.md?