wfxr / csview Goto Github PK
View Code? Open in Web Editor NEWπ Pretty and fast csv viewer for cli with cjk/emoji support.
Home Page: https://github.com/wfxr/csview
License: Apache License 2.0
π Pretty and fast csv viewer for cli with cjk/emoji support.
Home Page: https://github.com/wfxr/csview
License: Apache License 2.0
csview 1.2.2
The output of my_number
column is the following:
ββββββ¬βββββββββ¬ββββββββββββββ¬βββββββββββ
β Id β Sex β my_number β Embarked β
ββββββΌβββββββββΌββββββββββββββΌβββββββββββ€
β 1 β male β 12345.54321 β S β
β 2 β female β 123.321 β C β
β 3 β female β 123 β S β
β 4 β female β 12.21 β S β
β 5 β male β 1.1 β S β
β 6 β male β 0.1 β S β
β 7 β male β 0.01 β S β
β 8 β male β 0.001 β S β
ββββββ΄βββββββββ΄ββββββββββββββ΄βββββββββββ
The output of my_number
column in my mind is the following:
ββββββ¬βββββββββ¬ββββββββββββββ¬βββββββββββ
β Id β Sex β my_number β Embarked β
ββββββΌβββββββββΌββββββββββββββΌβββββββββββ€
β 1 β male β 12345.54321 β S β
β 2 β female β 123.321 β C β
β 3 β female β 123 β S β
β 4 β female β 12.21 β S β
β 5 β male β 1.1 β S β
β 6 β male β 0.1 β S β
β 7 β male β 0.01 β S β
β 8 β male β 0.001 β S β
ββββββ΄βββββββββ΄ββββββββββββββ΄βββββββββββ
v1.0.1
I do have a tsv-file with columns that contain comma-separated tags.
It would be cool if csview could display such nested structures by wrapping in multiple lines (at least if they're very long).
Example call:
cat myfile.tsv | csview -t --wrap=',' | less -S
csview 1.2.2
Thanks for such an awesome project! This is rock! π₯
It would be nice to have a (--sort|--sort-by|--sort-asc|--sort-dsc)
flag to sort items by providing header name: (I'm not sure about the flag namings)
"h1", "h2", "h3"
"ccc", "bbb", "aaa"
"bbb", "ccc", "bbb"
"aaa", "aaa", "ccc"
For example:
csview --sort-asc h1
:"h1", "h2", "h3"
"aaa", "aaa", "ccc"
"bbb", "ccc", "bbb"
"ccc", "bbb", "aaa"
csview --sort-dsc h2
:"h1", "h2", "h3"
"bbb", "ccc", "bbb"
"ccc", "bbb", "aaa"
"aaa", "aaa", "ccc"
WDYT?
Hi @wfxr
There was some effort in pretty-print
domain to note different libraries.
zhiburt/tabled#139
Because I know that csview
does pretty efficient csv
printing.
I was thinking if you'd expose it, I could highlight it.
Let me know if you're interested.
Take care.
I think,
You could do it relatively effortlessly.
Just create a lib.rs
and expose the functions.
Hi @wfxr
I bump into csview by
I think it's a great idea to not allocate the huge chunk of memory but rather do things lazily.
And I was thinking how to do it myself zhiburt/tabled#123
I was thinking about requiring Clone
for iterator so 1 pass for demension the second pass when print.
But it seems to be restrictive to me.
So I looked at your ideas.
And I just wonder if you've fixed the original issue.
Specifically my concern is about this Vec
allocation.
Line 20 in 5a1e6d9
Line 79 in 5a1e6d9
Am I wrong that essentially we will allocate n * m
memory anyway here.
Take care.
Thank you for cross issue references :)
1.3.0
I like this, but I can't find an option to turn the pager off. It messes with some of my shell scripts, especially if I run a large number of them, as I have to repeatedly intervene manually.
Hello, I think I've found a bug and would like to report it to you.
Reported behavior: open a csv file and application crashes with utf-8 error.
Tested on this dataset: https://catalog.data.gov/dataset/traffic-data/resource/e46a5cc5-ed4d-4b8d-b750-18e6c9ec570e
Exact command:
csview monroe-county-crash-data2003-to-2015.csv
Backtrace:
thread 'main' panicked at 'called
Result::unwrap()on an
Errvalue: Error(Utf8 { pos: Some(Position { byte: 512345, line: 4326, record: 4326 }), err: Utf8Error { field: 9, valid_up_to: 18 } })', src/core.rs:12:37 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace myuser@pop-os:~/Downloads$ RUST_BACKTRACE=1 csview monroe-county-crash-data2003-to-2015.csv thread 'main' panicked at 'called
Result::unwrap()on an
Errvalue: Error(Utf8 { pos: Some(Position { byte: 512345, line: 4326, record: 4326 }), err: Utf8Error { field: 9, valid_up_to: 18 } })', src/core.rs:12:37 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:78 3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt at src/libstd/sys_common/backtrace.rs:59 4: core::fmt::write at src/libcore/fmt/mod.rs:1076 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1537 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:62 7: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:49 8: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:198 9: std::panicking::default_hook at src/libstd/panicking.rs:217 10: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:526 11: rust_begin_unwind at src/libstd/panicking.rs:437 12: core::panicking::panic_fmt at src/libcore/panicking.rs:85 13: core::option::expect_none_failed at src/libcore/option.rs:1269 14: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::next 15: csview::main 16: std::rt::lang_start::{{closure}} 17: main 18: __libc_start_main 19: _start note: Some details are omitted, run with
RUST_BACKTRACE=fullfor a verbose backtrace.
Version of csview: 0.3.2-rc.0
OS: Pop!_OS 20.04 with Xanmod Kernel
Thank you very much in advance.
π it looks like 1.2.3 release did not get completed (ie did not get marked as latest release), raise this issue for some awareness. Thanks!
cc @wfxr
relates to Homebrew/homebrew-core#163690
Thank you for the great tool, I love using csview
and xsv
together! Would it be possible to have csview
behave more like a pager, namely to actually page the output when long, instead of having to manually pipe it again into less
? Whilst I understand the complexity of having to introduce a pager within an application, do you think that can be considered in scope (perhaps in the future)?
Having to always pipe into less makes csview
a little less independent as tool, as one would still have to use another application (less
) to search and display results on terminal.
ε¦ι’οΌθ°’θ°’οΌ
1.3.1
When I look at the Assets I see there is only one for the Mac INTEL processor, and not a Universal one or one for the ARM one.
Homebrew will send me one for ARM (when they come to it :-)-O) and the Intel one works on the Arm with Rosetta, but maybe one can adapt the rule to generate a Universal binary, or if that is not possible to generate one for Intel and one for Arm.
csview v0.3.4
Input csview command without parameter will get no repsonse in terminal. It seems something wrong? I think the csview cli should check the input parameters and if no input parameter are given (eg, only input csview
in terminal), error message should be given for better user experience.
N/A
Running brew tap wxfr/csview && brew install csview
on Linux with Linuxbrew, does not result in a working csview
.
I looked at the homebrew-csview
repository, and the darwin binary is hard coded there.
I'm not sure if it's possible, but is there a way that you could support distributing on Linux via Linuxbrew?
csview 1.1.0
Would it be possible to center the headers of the columns (if any)?
csview 1.2.2
Thank you for creating such an exceptional application. I frequently need to view CSV files with extended column widths, which unfortunately, do not display well in table view. Therefore, I would like to suggest the implementation of a csview flatten
feature, similar to xsv flatten
, but with line separation. I believe this enhancement would greatly improve the user experience. Thank you for considering my suggestion.
How do I install it on Ubuntu 20.04?
With the environment variable PAGER
unset, running csview
with a filename, results in less
showing the error message:
There is no -<E8> option ("less --help" for help)
Press RETURN to continue
when using standard input, the error is:
There is no -l option ("less --help" for help)
Press RETURN to continue
Running these commands with ltrace
shows that when the string LESS=-SF
is passed to the function putenv()
, the trailing null character is missing and extra garbage characters are added to the environment variable:
putenv("LESS=-SF\350\331\002\354p")
or putenv("LESS=-SFless")
Not being a rust programmer, I don't know the best way to correct this, but as a workaround, either one of the quick and dirty patches below fixes the issue for me.
In main.rs
replace the line
Err(_) => Pager::with_pager("less").pager_envs(["LESS=-SF"]).setup(),
with either
Err(_) => Pager::with_pager("less").pager_envs(["LESS=-SF\0"]).setup(),
or else with
Err(_) => Pager::with_pager("less -SF").setup(),
testing environment
TERMUX_APK_RELEASE=F_DROID
TERMUX_VERSION=0.118.0
Packages CPU architecture: aarch64
Android version: 14
rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball)
csview 1.3.2
~/.cargo/registry/src/index.crates.io-.../pager-0.16.1/
$ echo Name;Age;Sex; > test.csv
$ csview.exe test.csv
++
||
++
++
(checking manualβ¦)
$ csview.exe -d ; test.csv
++
||
++
++
(wtfβ¦)
$ csview.exe -d ; -H test.csv
+------+-----+------+
| Name | Age | Sex |
+------+-----+------+
(at last!)
Reverse -H
not to confuse newcomer with no data displayed, or at least donβt require it in case of single line.
Make csview
smarter in terms of recognizing common delimiters (for example, check this and that),
because comma is often used as decimal separator or even as is in cases like βPancakes;0,2kcal;Use flour, milk, eggs, honeyβ.
sudo -s
apt install cargo
cargo install csview
gives this error:
Compiling csview v1.1.0
error[E0658]: use of unstable library feature 'bool_to_option'
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/csview-1.1.0/src/table/mod.rs:92:50
|
92 | update_widths(&record, &mut widths, with_seq.then_some("#"));
| ^^^^^^^^^
error: failed to compile `csview v1.1.0`, intermediate artifacts can be found at `/tmp/cargo-installmangP5`
I know I can install the binary
greetings, el
csview 1.0.1
Have a csv file with newlines in the values. This will not be displayed properly.
It would be cool if csview would wrap such fields in multiple lines.
csview 0.3.6
First of all, thanks for this very nice and useful tool.
I'd like to view a large TSV-type file but it dies because of out-of-memory.
Steps to reproduce:
wget https://storage.googleapis.com/gcp-public-data--gnomad/release/2.1.1/vcf/exomes/gnomad.exomes.r2.1.1.sites.1.vcf.bgz
zcat "gnomad.exomes.r2.1.1.sites.1.vcf.bgz" | grep -v "^##" | csview -t | less -S
Would it be possible to limit csview
's memory usage and make it play nicely with less
?
csview 1.2.2
I find it easier to read if numbers were right aligned. Can that be implemented (as default or by switch)?
I also find amounts easier to read if they were formatted by the thousands, either by way of the locale or by something like
or similar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.