usaidwat/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2025 Michael Dippery <michael@monkey-robot.com>
3
4//! usaidwat is a command-line tool for quickly listing Redditor's comments
5//! and posts in the terminal. It finds the last 100 comments or posts a user
6//! has made and presents them as pageable text. It can also tally a user's
7//! comments or posts, showing a breakdown of the user's last 100 comments or
8//! posts by subreddit.
9//!
10//! # Examples
11//!
12//! (In all examples, replace `reddit_user` with the actual username of a
13//! Redditor.)
14//!
15//! Display a user's last 100 comments:
16//!
17//! ```bash
18//! usaidwat log reddit_user
19//! ```
20//!
21//! Summarize a user's last 100 comments and provide a tone and sentiment analysis
22//! using AI:
23//!
24//! ```bash
25//! usaidwat summary reddit_user
26//! ```
27//!
28//! Show a count of the user's last 100 comments by subreddit:
29//!
30//! ```bash
31//! usaidwat tally reddit_user
32//! ```
33//!
34//! Display a user's last 100 submissions:
35//!
36//! ```bash
37//! usaidwat posts log reddit_user
38//! ```
39//!
40//! Show a count of a user's last 100 submissions by subreddit:
41//!
42//! ```bash
43//! usaidwat posts tally reddit_user
44//! ```
45//!
46//! Show information about a Redditor, such as the age of their account and
47//! total karma breakdown:
48//!
49//! ```bash
50//! usaidwat info reddit_user
51//! ```
52//!
53//! Show a breakdown of which hours and days of the week a Redditor has
54//! commented:
55//!
56//! ```bash
57//! usaidwat timeline reddit_user
58//! ```
59//!
60//! Get usage and help for the tool:
61//!
62//! ```bash
63//! usaidwat --help
64//! ```
65//!
66//! # OpenAI API Setup
67//!
68//! To use the summarization feature provided by `usaidwat summary` and the
69//! [`Summarizer`](summary::Summarizer), you must set up access to OpenAI.
70//! To enable access:
71//!
72//! 1. Set up an [OpenAI API account].
73//! 2. Generate an [API key].
74//! 3. Copy and paste the generated key.
75//! 4. Store the generated key in your shell's `$OPENAI_API_KEY` environment
76//!    variable. Follow your shell's procedure for configuring environment
77//!    variables, but generally this involves running
78//!
79//!    ```bash
80//!    $ export OPENAI_API_KEY='copied api key'
81//!    ```
82//!
83//!    In your shell session or in your shell's configuration ("rc") file
84//!    (e.g., `~/.bashrc` or `~/.zshrc`).
85//!
86//! **You are solely responsible for the cost of your use of the OpenAI API!**
87//! See the [openai module documentation] for more information on the cost of
88//! using the OpenAI API.
89//!
90//! By default, `usaidwat summary` will use the [cheapest model]; see
91//! `usaidwat summary -h` for other options.
92//!
93//! Currently only OpenAI's API is supported by usaidwat, but support for additional
94//! providers may be added in the future.
95//!
96//! # License
97//!
98//! usaidwat is licensed under the terms of the [Apache License 2.0]. Please
99//! see the LICENSE file accompanying this source code or visit the previous
100//! link for more information on licensing.
101//!
102//! [Apache License 2.0]: https://www.apache.org/licenses/LICENSE-2.0
103//! [API key]: https://platform.openai.com/settings/organization/api-keys
104//! [OpenAI API account]: https://platform.openai.com/docs/overview
105//! [cheapest model]: https://docs.rs/cogito/latest/cogito/trait.AIModel.html#tymethod.cheapest
106//! [openai module documentation]: https://docs.rs/cogito-openai
107
108pub mod cli;
109pub mod count;
110pub mod filter;
111pub mod markdown;
112pub mod reddit;
113pub mod summary;
114pub mod text;
115pub mod view;
116
117#[cfg(test)]
118mod test_utils;