tv

授权协议 Unlicense License
开发语言 Rust
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 姚乐家
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Rust

Tidy Viewer (tv)

Tidy Viewer (tv) is a cross-platform csv pretty printer that uses column styling to maximize viewer enjoyment.

Pretty Printing

Contents

Installation

The following install options are available

  1. Cargo Install from crates.io
  2. Debian .deb install
  3. AUR
  4. MacOS
  5. ARM
  6. Windows
  7. Build from source
  8. Snap
  9. Homebrew

1. Cargo Install

The following will install from the crates.io source. For convenience add the alas alias tv='tidy-viewer' to bashrc.

cargo install tidy-viewer
sudo cp /home/$USER/.cargo/bin/tidy-viewer /usr/local/bin/.
echo "alias tv='tidy-viewer'" >> ~/.bashrc
source ~/.bashrc

2. Debian

The below instructions work with the most recent release <VERSION> found here release page.

wget https://github.com/alexhallam/tv/releases/download/<VERSION>/tidy-viewer_<VERSION>_amd64.deb
sudo dpkg -i tidy-viewer_<VERSION>_amd64.deb
echo "alias tv='tidy-viewer'" >> ~/.bashrc
source ~/.bashrc

3. AUR

Kindly maintained by @yigitsever

paru -S tidy-viewer

4-7. Other releases

We currently cut releases for the following architectures. Download from the release page.

  • MacOS
  • ARM
  • Windows
  • Build from source (Most general)

The instuctions for all of the above are very similar with the following general steps.

  1. Download your desired release from the release page
  2. tar -xvzf <RELEASE_FILE_NAME>
  3. cd into uncompressed folder
  4. Find binary tidy-viewer

After the above steps I would highly reccomend you make an alias for tidy-viewer as shown for other builds.

8. Snap

sudo snap install --edge tidy-viewer
tidy-viewer --help

9. Homebrew

brew tap alexhallam/tidy-viewer
brew install tidy-viewer

Examples

Have some fun with the following datasets!

Diamonds

# Download the diamonds data
wget https://raw.githubusercontent.com/tidyverse/ggplot2/master/data-raw/diamonds.csv

# pipe to tv
cat diamonds.csv | tv

Starwars

wget https://raw.githubusercontent.com/tidyverse/dplyr/master/data-raw/starwars.csv

# Pass as agrument
tv starwars.csv

Pigeon Racing

wget https://raw.githubusercontent.com/joanby/python-ml-course/master/datasets/pigeon-race/pigeon-racing.csv
cat pigeon-racing.csv | tv

Titanic

wget https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv
tv titanic.csv

Significant Figure Definitions And Rules

The first three digits represent > 99.9% the value of a number. -- GNU-R Pillar

tv uses the same significant figure (sigfig) rules that the R package pillar uses.

The purpose of the sigfig rules in tv is to guide the eye to the most important information in a number. This section defines terms and the decision tree used in the calculation of the final value displayed.

Definitions

     ┌─────┐      ┌─────┐     ─┐
     │     │      │     │      │
     │     │      │     │      │
     │     │      │     │      │
     │     │      │     │      │
     │     │  ┌┐  │     │      │
     └─────┘  └┘  └─────┘    ──┴─
   │        │    │                │
   └────────┘  ▲ └────────────────┘
left hand side │  right hand side
     (lhs)     │       (rhs)

            decimal

left hand side (lhs): digits on the left hand side of the decimal.

right hand side (rhs): digits on the right hand side of the decimal.


 ┌─────┐      ┌─────┐     ─┐     ┌─────┐
 │     │      │     │      │     │     │
 │     │      │     │      │     │     │
 │     │      │     │      │     │     │
 │     │      │     │      │     │     │
 │     │  ┌┐  │     │      │     │     │
 └─────┘  └┘  └─────┘    ──┴─    └─────┘

│                     │         │       │
└─────────────────────┘         └───────┘
       leading 0s              trailing 0s

leading 0s: 0s to the left of a non-zero.

trailing 0s: 0s to the right of a non-zero. The zeros in 500m are trailing as well as the 0s in 0.500km.

 ─┐     ┌─────┐       ─┐
  │     │     │        │
  │     │     │        │
  │     │     │        │
  │     │     │        │
  │     │     │  ┌┐    │
──┴─    └─────┘  └┘  ──┴─

                   │        │
                   └────────┘
              fractional digit(s)

fractional digits: Digits on the rhs of the decimal. The represent the non-integer part of a number.

Rules

There are only 4 outputs possible. The significant figures to display are set by the user. Assume sigfig = 3:

  1. lhs only (12345.0 -> 12345): If no fractional digits are present and lhs >= sigfig then return lhs
  2. lhs + point (1234.5 -> 1234.): If fractional digits are present and lhs >= sigfig then return lhs with point. This is to let the user know that some decimal dust is beyond the main mass of the number.
  3. lhs + point + rhs (1.2345 -> 1.23): If fractional digits are present and lhs < sigfig return the first three digits of the number.
  4. long rhs (0.00001 -> 0.00001): This is reserved for values with leading 0s in the rhs.
# Psuedo Code: Sigfig logic assuming sigfig = 3
if lhs == 0:
    n = ((floor(log10(abs(x))) + 1 - sigfig)
    r =(10^n) * round(x / (10^n))
    return r
    // (0.12345 -> 0.123)
else:
    if log10(lhs) + 1 > sigfig:
        if rhs > 0:
            //concatenate:
            //(lhs)
            //(point)
            //(123.45 -> 123.)
        else:
            //concatenate:
            //(lhs)
            //(1234.0 -> 1234)
            //(100.0 -> 100)
    else:
        //concatenate:
        //(lhs)
        //(point)
        //sigfig - log10(lhs) from rhs
        //(12.345 -> 12.3)
        //(1.2345 -> 1.23)

Tools to pair with tv

tv is a good compliment to command line data manipulation tools. I have listed some tools that I like to use with tv.

xsv - Command line csv data manipulation. [Rust | CLI]

csvtk - Command line csv data manipulation. [Go | CLI]

tsv-utils - Command line csv data manipulation toolkit. [D | CLI]

q - Command line csv data manipulation query-like. [Python | CLI]

miller - Command line data manipulation, statistics, and more. [C | CLI]

VisiData - An interactive terminal user interface that is built to explore and wrangle data. [Python | TUI]

Tools similar to tv

column Comes standard with linux. To get similar functionality run column file.csv -ts,

Though column is similar I do think there are some reasons tv is a better tool.

1. NA comprehension

NA values are very important! Viewers should have their attention drawn to these empty cells. In the image below NA values are not only invisible, but it seems to be causing incorrect alignment in other columns.

There are many ways that programs will designate missing values. Some use none, others use NaN, and many more "", NA, null, n/a etc. tv searches for these strings and replaces them with NA. This is similar in spirit to the significant digit calculations and the truncation of columns with long strings. The purpose of tv is not to show the complete literal value, but to guide the eye.

2. Column Overflow Logic

In cases where the terminal width can't fit all of the columns in a dataframe, column will try to smush data on the rows below. This results in an unpleasant viewing experience.

tv can automatically tell when there will be too many columns to print. When this occurs it will only print the columns that fit in the terminal and mention the extras in the footer below the table.

Configuration Dotfile

For information on dotfile configuration see tv --help. This allows users to set their own color palette, rows to print, max column width, etc.

Help

tv --help

tv 0.0.20
Tidy Viewer (tv) is a csv pretty printer that uses column styling to maximize viewer enjoyment.✨✨��✨✨

    Example Usage:
    wget https://raw.githubusercontent.com/tidyverse/ggplot2/master/data-raw/diamonds.csv
    tv diamonds.csv
    
    Configuration File Support:
    An example config is printed to make it easy to copy/paste to `tv.toml`.
    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
        * Windows: {FOLDERID_RoamingAppData}\tv.toml

        ## ==Tidy-Viewer Config Example==
        ## Remove the first column of comments for valid toml file
        ## The delimiter separating the columns. [default: ,]
        #delimiter = ","
        ## Add a title to your tv. Example 'Test Data' [default: NA ("")]
        #title = ""
        ## Add a footer to your tv. Example 'footer info' [default: NA ("")]
        #footer = ""
        ## The upper (maxiumum) width of columns. [default: 20]
        #upper_column_width = 20
        ## The minimum width of columns. Must be 2 or larger. [default: 2]
        #lower_column_width = 2
        ## head number of rows to output <row-display> [default: 25]
        #number = 35
        ## meta_color = [R,G,B] color for row index and "tv dim: rowsxcols"
        #meta_color = [64, 179, 162]
        ## header_color = [R,G,B] color for column headers
        #header_color = [232, 168, 124]
        ## std_color = [R,G,B] color for standard cell data values 
        #std_color = [133, 205, 202]
        ## na_color = [R,G,B] color for NA values
        #na_color = [226, 125, 95]

USAGE:
    tidy-viewer [FLAGS] [OPTIONS] [FILE]

FLAGS:
    -d, --debug-mode    Print object details to make it easier for the maintainer to find and resolve bugs.
    -h, --help          Prints help information
    -V, --version       Prints version information

OPTIONS:
    -c, --color <color>
            There are 5 preconfigured color palettes:
                            (1)nord
                            (2)one_dark
                            (3)gruvbox
                            (4)dracula
                            (5)uncolor (Coming Soon)
            An input of (5)uncolor will remove color properties. Note that colors will make it difficult to pipe output
            to other utilities.The default value of (0) is reserved to make config/option coloring logic easier.
            [default: 0]
    -s, --delimiter <delimiter>                      The delimiter separating the columns. [default: ,]
    -f, --footer <footer>                            Add a footer to your tv. Example 'footer info' [default: NA]
    -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]
    -t, --title <title>                              Add a title to your tv. Example 'Test Data' [default: NA]
    -u, --upper-column-width <upper-column-width>    The upper (maxiumum) width of columns. [default: 20]

ARGS:
    <FILE>    File to process

Inspiration

pillar - R's tibble like formatting. Fantastic original work by Kirill Müller and Hadley Wickham. tv makes an attempt to port their ideas to the terminal.

  • 智能电视机四大操作系统介绍 近年来智能电视机四大操作系统介绍随着电视机技术的发展,电视机智能化的趋势愈加明显,步伐也越来越快,智能电视机不仅在外形、画质等方面拥有独特的优势,而且能为用户提供丰富的功能。目前市场有哪些主流的智能电视操作系统呢?   主流智能电视操作系统一:安卓操作系统(主流)   目前,Android操作系统是智能电视比较主流的选择,包括TCL、康佳、创维、索尼等彩电厂商都推出过A

  • 一、有线电视CATV、IPTV和OTT TV的区别 (1) 在业务运营商方面:有线电视是广电运营,IPTV业务的运营商为电信运营商负责,而OTT TV业务是由7家互联网集成平台牌照商(CNTV、百视通、华数、南方传媒、湖南广电、中央人民广播电台、中国国际广播电台)提供,用户在租用了运营商的宽带业务后,OTT业务不会再为运营商带来其他的收益。 (2) 在内容提供商方面:IPTV主要是牌照商的内容提供

  • 什么是OTT   OTT 是“Over The Top”的缩写,是 指通过互联网向用户提供各种应用服务 。这种应用和目前运营商所提供的通信业务不同,它 仅利用运营商的网络 ,而 服务由运营商之外的第三方提供 。目前,典型的OTT业务有互联网电视业务,苹果应用商店等。 OTT应用   应用商店是典型OTT应用,苹果开通App Store后,Google开通了Android Market、诺基亚、微软

  • 在ATV SDK中,TV APP也是一个比较重要的apk,他负责显示各种输入源,比如HDMI IN输入,AV IN输入,因为要显示不同的源,具体硬件平台又步一样,所以一定会涉及到相关定义。每一个不同的芯片,其TV APK都需要定制。本系列文章基于amlogic ATV SDK,分析amlogic  平台上是如何实现显示切换的。 Android TV系列 TV APP分析(一) 一、概述 代码位置:

  • jable.tv 是什么? 我无法提供有关 jable.tv 的任何信息,因为我的知识截止日期是 2021 年,并且我并不能浏览网络。如果您有关于 jable.tv 的任何问题,可能需要使用其他资源来寻找答案。

  • 芒果tv在使用的时候,不少小伙伴们发现不能投屏,想知道怎么回事,不清楚怎么回事的小伙伴们,就让小编给大家详细的讲讲,一起来看看这个怎么回事吧。 为什么芒果tv不能投屏 芒果TV可以投屏到电视。 但是投屏功能由后台控制,并不是每个视频都能投,有部分视频并不支持。 手机和设备(如您的电视机或机顶盒)在同一无线网络的情况下,打开手机内的芒果软件视频 ,点击全屏后查看右上角是否有投屏的图标。如果显示有,并

  • TV Loss介绍  TV loss全称Total Variation Loss,其作用主要是降噪,图像中相邻像素值的差异可以通过降低TV Loss来一定程度上进行解决 ,从而保持图像的光滑性。 TV Loss定义  连续TV Loss的定义为: J T 0 ( u ) = ∫ D u u x 2 + u y 2 d x d y J_{T_0}(u)=\int_{D_u}\sqrt{u^2_x+u

  • Exclusively for etisalat subscribers, myplex TV is one of the best Live TV app available to watch over 50+ live TV channels through online streaming, Classic Hindi, English, Bengali and Telugu Movies

 相关资料
  • 问题内容: 创建具有子元素的透明元素时遇到问题。使用此代码,子元素将从父元素获取不透明度值。 我需要将孩子的元素不透明度重置/设置为任意值。参考的浏览器为。 编辑标记 问题答案: 您可能遇到的问题(基于查看选择器)是不透明度会影响父对象的所有子元素: 但是有解决方案!使用rgba背景值,您可以随时随地保持透明:) 对于文本,您可以只使用相同的rgba代码,但是将其设置为CSS的color属性: 但

  • 问题内容: 电视的大多数应用程序都是基于Web的(html,javascript和css),我想将现有的电视Web应用程序移植到tvOS。 Xcode中的SDK没有显示像iOS中那样的Webview实现,无法创建基于html,javascript和css的应用,但是根据文档,可以使用tvjs框架使用javascript ,但是Apple拥有自己的标记语言,而不是html用于称为TVML的电视。 我

  • 本文向大家介绍基于jQuery和CSS3实现APPLE TV海报视差效果,包括了基于jQuery和CSS3实现APPLE TV海报视差效果的使用技巧和注意事项,需要的朋友参考一下 用CSS和jQuery来实现它,尽量看起来和原效果一样。 本教程里,我将使用CSS,HTML和jQuery来创建一个近似Apple TV视差效果,如果你正在阅读,我假设你对上述三种技术都有基本的了解。 废话不多说,开始第

  • 我有一个使用两个模块(库)的项目,我在我的一个库中创建了一些活动及其相应的布局文件,我似乎无法在该布局中添加新视图(Textview、Imageview等)。这是logcat输出。

  • 了解如何使用 Adobe Lightroom for Apple TV 应用程序。 Adobe Photoshop Lightroom for Apple TV 应用程序允许您在 TV 上查看 Lightroom 云照片、视频及相册,并在 TV 上放映幻灯片。当 Lightroom for Apple TV 应用程序正在运行时,如果您对 Lightroom (桌面版、移动设备版及 Web 版)或

  • 了解如何在 Apple TV(第 4 代或更新机型)上下载和设置 Lightroom 应用程序。 注意:App Store 不再提供 Lightroom for Apple TV 版本 1.2.3。此版本已替换为较新版本的 Lightroom for Apple TV 应用程序,且该较新版本的应用程序与 iPhone 版 Lightroom 捆绑在一起。 如果您当前使用的是 Lightroom f

  • 我的活动中有这个事件处理程序: 在Android TV设备模拟器中调试时,我可以看到KEYCODE_DPAD_LEFT和KEYCODE_MEDIA_PLAY_PAUSE,当我按下方向板扩展控制中的按钮时。 但当我按“快进”或“快退”媒体键时,会触发“向上键”事件,但键代码“无法识别”。 KeyEvent{action=action\u UP,keyCode=keyCode\u UNKNOWN,sc

  • 我有一个Android电视棒,我想区分支持什么HDCP版本? 我已经找到了一些东西,似乎很管用: 但文件上说 在API级别28中添加 如何读取旧API的HDCP级别