Skip to content

Commit

Permalink
Improve documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
theoforger committed Nov 21, 2024
1 parent 168b3f5 commit dbb4608
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
17 changes: 4 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ git clone https://github.com/theoforger/mastermind.git
cd mastermind
```

### Configure Environment Variables

Make a copy of [`example.env`](example.env) and name it `.env`

```bash
cp example.env .env
```

Edit `.env` to add or modify:
- API key
- The base URL of an OpenAI-compatible API
- A default language model

### Build the Project

Run the following command:
Expand All @@ -48,6 +35,10 @@ Run the following command:
cargo build
```

### Configure Environment Variables

See: https://github.com/theoforger/mastermind?tab=readme-ov-file#%EF%B8%8F-configure


## ✒️ Linting / Code Formatting
Before you commit, make sure the following linting/formatting tools using the options below. Commit only when your code is error/warning free.
Expand Down
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Written in Rust 🦀, because why not?

<img src="images/demo.gif" alt="A gif demo of the basic functions of this program."/>

## 💻 Usage

## 📖 Prepare
To get started, prepare two text files:

1. **Words to Link Together** - Contains the words from your own team.
Expand All @@ -21,7 +20,32 @@ To get started, prepare two text files:

One word per line. Refer to the [`examples`](examples) directory for sample files.

Run the tool with:
## 🛠️ Configure
Here are what you need to configure before running mastermind:
- API key
- The base URL of an OpenAI-compatible API
- A default language model

There are two ways to configure this program:
### Config File
During the first run, a config file will be created at your system's preferred location. The specific location will be given in the output. Generally, it is located at:
- For Linux: `$HOME/.config/mastermind/config.toml`
- For macOS: `$HOME/Library/Application Support/mastermind/config.toml`
- For Windows: `C:\Users\[your username]\AppData\Roaming\mastermind\config.toml`

### Environment Variables
Make a copy of [`example.env`](example.env) and name it `.env`

```bash
cp example.env .env
```

Then edit `.env` and provide you preferred configuration.

Alternatively, you can simply pass these environment variables during run time.


## 🏃 Run

```bash
mastermind [TO_LINK] [TO_AVOID]
Expand Down
8 changes: 7 additions & 1 deletion src/configs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ impl Config {
doc["model"]["default"] = value("");

// Write the document to the config file
println!("Config file not found or empty. Creating one...");
println!(
"Looks like it's your first run\n\
Creating a config file at {}\n\
Make sure to modify it first or use the proper environment variables\n\
See: https://github.com/theoforger/mastermind?tab=readme-ov-file#%EF%B8%8F-configure",
config_file.display()
);
fs::write(&config_file, doc.to_string())?;

doc
Expand Down

0 comments on commit dbb4608

Please sign in to comment.