1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//!`clipivot` is a command-line tool for quickly creating pivot tables.
//!
//! If you want to use the program, visit the
//! [Github repo](https://github.com/maxblee/clipivot) for installation
//! and usage instructions. If, on the other hand, you want to contribute to `clipivot`'s
//! development, read on.
//!
//! In particular, I strongly advise you to read the brief bit at the top of the page for the
//! `aggregation` module. That bit should show you how `clipivot` is structured, so you can
//! more knowledgeably explore the tool.
//!
//! # How to help
//! Regardless of your programming experience, you can help make `clipivot` a better tool.
//!
//! ## Requires programming experience
//! - Performance: I've tried to design `clipivot` to be reasonably performant, but I'm sure there
//! are places where performance could be optimized. If you have any suggestions, I'd love to hear them.
//! (Note: I'm aware that there are technically faster algorithms for computing median than the one I
//! wound up with, the [`BTreeMap`](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html)
//! in Rust's standard library. The reason I chose the `BTreeMap` is that it is well-suited for
//! adding items from a stream and it is more memory efficient than other algorithms I'm aware of.
//! But let me know if you're aware of a way to improve the speed of the median computation
//! while maintaining the best case memory efficiency of `BTreeMap`.)
//! - Coding style: This is my first project in Rust, so I'm sure there are parts of the code
//! that are not idiomatic in Rust or that are poorly structured.
//! - Testing: I think I've included fairly decent testing for this tool, but I'm sure there are places
//! where my testing can improve.
//!
//! ## Doesn't require programming experience
//! - Bugs: If something in this program doesn't work like you think it's supposed to, please let me know.
//! - Error handling: I've tried to make error handling as clear and helpful as possible, so if an error
//!  message you get from `clipivot` confuses you, let me know and I'll do what I can to fix it.
//!
//! In particular, pretty much nothing you run should ever result in what Rust calls a "panic" — basically an unanticipated,
//! fast exit from a program. Panics look something like:
//!
//! ```sh
//! thread 'main' panicked at 'explicit_panic', src/main.rs:5:1
//! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
//! ```
//!
//! - Documentation: You shouldn't be confused about how to get `clipivot` to work. If you've read the guide
//! on GitHub and the help message and are confused by part of it, please let me know.
//!
//! - Features: I don't have any new features in mind for `clipivot`, but if you do,
//! let me know and I'll consider whether or not I think it makes sense to add the feature.
//!
//! # Development Environment
//! In order to contribute code, first clone the repository to install the source code:
//!
//! ```sh
//! $ git clone https://github.com/maxblee/clipivot
//! ```
//!
//! Then, make changes to the code and/or add/change tests, and then run
//!
//! ```sh
//! $ cargo test
//! ```
//!
//! to run tests.
//! ## Formatting
//! In addition, I use `clippy` to lint code and `rustfmt` to automatically format code.
//!
//!
//! To install them, type
//! ```sh
//! $ rustup update
//! $ rustup component add rustfmt --toolchain stable
//! $ rustup component add clippy --toolchain stable
//! ```
//! And from there, you can run `rustfmt` with
//! ```sh
//! $ cargo fmt --all
//! ```
//! and `clippy` with
//! ```sh
//! $ cargo clippy -- -A clippy::ptr_arg
//! ```
//! **Note that I am ignoring the `clippy::ptr_arg` warning, which raises a warning
//! when you put a `&Vec<T>` into a function call.**
//!
//! # Contact me
//! To get in touch with me about `clipivot`, send me an email at <maxbmhlee@gmail.com> or submit an issue on
//! the GitHub page.

#[macro_use]
extern crate clap;

pub mod aggfunc;
pub mod aggregation;
pub mod cli;
pub mod cli_settings;
pub mod errors;
pub mod parsing;