sales

Crates.iosales
lib.rssales
version0.2.0
created_at2025-07-16 13:35:18.214597+00
updated_at2025-08-08 11:25:35.139705+00
descriptionA command-line tool, and library, for reporting and aggregating sales data (for example, from CSV files).
homepagehttps://github.com/bitfield/sales
repositoryhttps://github.com/bitfield/sales
max_upload_size
id1755516
size59,630
John Arundel (bitfield)

documentation

https://docs.rs/sales

README

Crate Docs CI Audit Maintenance

The sales crate provides a command-line tool, and library, for reporting and aggregating sales data (for example, from CSV files).

Installation

cargo install sales

Usage

Download your sales data for the relevant period to a file, for example, data.csv, and run:

sales data.csv

Example output:

Product / Group                                       Units      Revenue
------------------------------------------------------------------------
Go mentoring                                             11      3134.45
Code For Your Life                                        2        79.90
For the Love of Go (2023)                                 1        39.95
For the Love of Go: Video/Book Bundle (2023 edition)      1        74.95
The Power of Go: Tests                                    1        39.95
The Power of Go: Tools                                    1        39.95
------------------------------------------------------------------------
Total                                                    17      3409.15

Sorting by revenue

The default sorting is by unit sales, descending, and then alphabetically. To sort by revenue instead, use the --revenue flag:

sales --revenue data.csv
Product / Group                                       Units      Revenue
------------------------------------------------------------------------
Go mentoring                                             11      3134.45
Code For Your Life                                        2        79.90
For the Love of Go: Video/Book Bundle (2023 edition)      1        74.95
For the Love of Go (2023)                                 1        39.95
The Power of Go: Tests                                    1        39.95
The Power of Go: Tools                                    1        39.95
------------------------------------------------------------------------
Total                                                    17      3409.15

Grouping related products

To aggregate the sales data for a group of related products, create a group specification file with the following format:

GROUP_NAME | GROUP_REGEX

A simple example, which groups two sets of products by matching shared substrings in their names:

For the Love of Go | For the Love
Power of Go Series | The Power of Go

Use the --groups flag to apply this group specification, and rerun the tool to see the result:

sales --groups groups.txt data.csv
Product / Group     Units      Revenue
--------------------------------------
Go mentoring           11      3134.45
Code For Your Life      2        79.90
For the Love of Go      2       114.90
Power of Go Series      2        79.90
--------------------------------------
Total                  17      3409.15

Input formats

sales can interpret CSV data produced by Squarespace, Gumroad, and similar platforms. It reads only the product name, price, and quantity columns.

  • The product name column heading should be "Lineitem name" or "Item Name".

  • The product price column heading should be "Lineitem price" or "Item Price ($)".

  • The product quantity column heading should be "Lineitem quantity" or "Quantity".

Commit count: 0

cargo fmt