Crates.io | dsv-seeker |
lib.rs | dsv-seeker |
version | 0.1.0 |
source | src |
created_at | 2022-11-07 15:17:20.987875 |
updated_at | 2022-11-07 15:17:20.987875 |
description | A simple DSV query interpreter |
homepage | |
repository | https://github.com/HoloTheDrunk/dsv-util |
max_upload_size | |
id | 707283 |
size | 34,803 |
A small tool to run basic queries on DSV files.
"select" ("*" | (name ("," name)*))
The select
command keeps only the desired columns.
"where" name (("=" value) | ("like" pattern))
The where
command filters rows based on string equality or pattern matching of the value in the name
d column.
"enum" name
The enum
command outputs two columns, respectively the number of appearances of a value and the value itself.
This is similar in a way to running uniq -c
in Bash.
"sort" "num"? name ("asc" | "desc")
The sort
command sorts rows based on the name
d column.
"trim" ("*" | (name ("," name)*))
The trim
command removes heading and trailing whitespace from desired columns' values.
behead
The behead
command removes the first line, that usually being the headers.
Commands are organized in isolated modules as much as possible.
Steps
command
rule.command
rule.Command
enum in src/ast.rs
.Command::[your_rule]
in src/ast.rs::build_command
.src/operators/
and add the new module to src/operators/mod.rs
.src/ast.rs::Ast::run_on
.src/main.rs::Cli
doc comment.