Skip to content

Commit

Permalink
working config read with optional input (#166)
Browse files Browse the repository at this point in the history
* working config read with optional input

* make some changes to config vs flag logic

* add changelog info
  • Loading branch information
alexhallam authored Jul 4, 2023
1 parent 2722ec1 commit d723ca5
Show file tree
Hide file tree
Showing 5 changed files with 344 additions and 58 deletions.
32 changes: 30 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
1.4.31 (2023-02-02)


1.5.0 (2023-07-04)
==================

* **Feature** Add a `f` flag for the ability to print all rows
* **Feature** A new flag and associated output is available. The new flat is `--config-details` or `-C`. This will allow users to see the current configuration of `tv`. This is useful for debugging. Here is an example of the output:

```sh
> tidy-viewer -C

tv.toml
[+] delimiter = ","
[+] title = ""
[-] footer = None
[+] upper_column_width = 20
[+] lower_column_width = 2
[+] number = 35
[-] extend_width_length = None
[+] meta_color = [Integer(255), Integer(0), Integer(0)]
[+] header_color = [Integer(232), Integer(168), Integer(124)]
[+] std_color = [Integer(133), Integer(205), Integer(202)]
[+] na_color = [Integer(226), Integer(125), Integer(95)]
[-] neg_num_color = None
```

- The `[+]` indicates that the values was found in the `tv.toml` file.

- The `[-]` indicates that the value was not found in the `tv.toml` file and the default value was used.

* **Bug** [#165](https://github.com/alexhallam/tv/issues/165) The `tv.toml` has had a long history of being buggy. This is because users must provide entries for every key. I removed this constraint. Now, if a key is not provided, the default value is used. This should make the `tv.toml` more user friendly. Thanks @winter-again for the bug report.
* **Bug** [#163](https://github.com/alexhallam/tv/issues/163) Option `--number of rows to output` requires spaces between words instead of dashes. All other long form options use a dash to delimit words. Thanks @derekmahar for bug report.


1.4.30 (2022-08-23)
==================
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Unlicense/MIT"
name = "tidy-viewer"
readme = "README.md"
repository = "https://github.com/alexhallam/tv"
version = "1.4.31"
version = "1.5.0"

[package.metadata.deb]
assets = [
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ For information on dotfile configuration see `tv --help`. This allows users to s
`tv --help`

```txt
tv 1.4.31
tv 1.5.0
Tidy Viewer (tv) is a csv pretty printer that uses column styling to maximize viewer enjoyment.✨✨📺✨✨
Example Usage:
Expand All @@ -335,6 +335,7 @@ Tidy Viewer (tv) is a csv pretty printer that uses column styling to maximize vi
Configuration File Support:
An example config is printed to make it easy to copy/paste to `tv.toml`.
Check the parameters you have changed with `tv --config-details`.
The config (tv.toml) location is dependent on OS:
* Linux: $XDG_CONFIG_HOME or $HOME/.config/tv.toml
* macOS: $HOME/Library/Application Support/tv.toml
Expand All @@ -355,9 +356,8 @@ Tidy Viewer (tv) is a csv pretty printer that uses column styling to maximize vi
#lower_column_width = 2
## head number of rows to output <row-display> [default: 25]
#number = 35
## extend width and length in terms of the number of rows and columns displayed beyond term width [default:
false]
# extend_width_and_length = true
## extend width and length in terms of the number of rows and columns displayed beyond term width [default: false]
# extend_width_length = true
## meta_color = [R,G,B] color for row index and "tv dim: rows x cols"
#meta_color = [64, 179, 162]
## header_color = [R,G,B] color for column headers
Expand All @@ -373,6 +373,7 @@ USAGE:
tidy-viewer [FLAGS] [OPTIONS] [FILE]
FLAGS:
-C, --config-details Show the current config details
-d, --debug-mode Print object details to make it easier for the maintainer to find and resolve bugs.
-e, --extend-width-and-length Extended width beyond term width (do not truncate). Useful with `less -S`.
-f, --force-all-rows Print all rows in file. May be piped to 'less -S'. Example `tidy-viewer
Expand All @@ -397,7 +398,7 @@ OPTIONS:
-l, --lower-column-width <lower-column-width>
The lower (minimum) width of columns. Must be 2 or larger. [default: 2]
-n, --number of rows to output <row-display> Show how many rows to display. [default: 25]
-n, --number-of-rows-to-output <row-display> Show how many rows to display. [default: 25]
-g, --sigfig <sigfig> Significant Digits. Default 3. Max is 7 [default: 3]
-t, --title <title> Add a title to your tv. Example 'Test Data' [default: NA]
-u, --upper-column-width <upper-column-width> The upper (maximum) width of columns. [default: 20]
Expand Down
Loading

0 comments on commit d723ca5

Please sign in to comment.