Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add CLI option --emojis to change README header prefixes #67

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

All notable changes to the *readme-ai* project will be documented in this file.

---
## [v0.1.6] - *2023-10-20*


---

## [v0.1.5] - *2023-10-15*
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,18 @@ poetry install

To generate a *README.md* file, use the `readmeai` command in your terminal, along with the arguments below.

| Short Flag | Long Flag | Description | Status |
|------------|----------------|-----------------------------------------------------|--------------|
| `-k` | `--api-key` | Your language model API secret key. | Optional |
| `-b` | `--badges` | Select 'shields' or 'square' to change badge style. | Optional |
| `-f` | `--offline-mode`| Run offline without calling the OpenAI API. | Optional |
| `-m` | `--model` | Large language model engine (gpt-3.5-turbo) | Optional |
| `-o` | `--output` | The output path for your README.md file. | Optional |
| `-r` | `--repository` | The URL or path to your code repository. | Required |
| `-t` | `--temperature`| The temperature (randomness) of the model. | Optional |
| `-l` | `--language` | The language of text to write README in. | Coming Soon! |
| `-s` | `--style` | The README template style to build. | Coming Soon! |
| Short Flag | Long Flag | Description | Type | Status |
|------------|------------------|-----------------------------------------------------|-------------|--------------|
| `-k` | `--api-key` | Your language model API secret key. | String | Optional |
| `-b` | `--badges` | Select 'shields' or 'square' to change badge style. | String | Optional |
| `-e` | `--emojis` | Add emojis to your README.md file heading sections | Boolean | Optional |
| `-f` | `--offline-mode` | Run offline without calling the OpenAI API. | Boolean | Optional |
| `-m` | `--model` | Large language model engine (gpt-3.5-turbo) | String | Optional |
| `-o` | `--output` | The output path for your README.md file. | Path/String | Optional |
| `-r` | `--repository` | The URL or path to your code repository. | URL/String | Required |
| `-t` | `--temperature` | The temperature (randomness) of the model. | Float | Optional |
| `-l` | `--language` | The language of text to write README in. | String | Coming Soon! |
| `-s` | `--style` | The README template style to build. | String | Coming Soon! |

<br>

Expand Down
68 changes: 27 additions & 41 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "readmeai"
version = "0.4.026"
description = "πŸš€ Generate beautiful README.md files from the terminal. Powered by OpenAI's GPT LLMs πŸ’«"
version = "0.4.027"
description = "πŸš€ Generate beautiful README files from the terminal, powered by AI. πŸ’«"
authors = ["Eli <0x.eli.64s@gmail.com>"]
license = "MIT"
readme = "README.md"
Expand Down
9 changes: 3 additions & 6 deletions readmeai/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
@click.command()
@options.api_key
@options.badges
@options.encoding
@options.endpoint
@options.emojis
@options.offline_mode
@options.model
@options.output
Expand All @@ -23,8 +22,7 @@
def commands(
api_key: str,
badges: Optional[str],
encoding: Optional[str],
endpoint: Optional[str],
emojis: Optional[bool],
offline_mode: Optional[bool],
model: Optional[str],
output: Optional[str],
Expand All @@ -37,8 +35,7 @@ def commands(
main(
api_key=api_key,
badges=badges,
encoding=encoding,
endpoint=endpoint,
emojis=emojis,
offline_mode=offline_mode,
model=model,
output=output,
Expand Down
16 changes: 5 additions & 11 deletions readmeai/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@
- 'shields' refers to badges from shields.io \
- 'square' refers to app-like square badges.""",
)
encoding = click.option(
"-c",
"--encoding",
default="cl100k_base",
help="Encoding used to tokenize text.",
emojis = click.option(
"-e",
"--emojis",
default=True,
help="Emojis prefixed to all README heading sections.",
)
endpoint = click.option(
"--endpoint",
default="https://api.openai.com/v1/chat/completions",
help="Large language model API endpoint.",
)

model = click.option(
"-m",
"--model",
Expand Down
7 changes: 7 additions & 0 deletions readmeai/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class ApiConfig(BaseModel):
offline_mode: bool


class CliConfig(BaseModel):
"""Command-line interface configuration."""

emojis: bool


class GitConfig(BaseModel):
"""Pydantic model for Git repository configuration."""

Expand Down Expand Up @@ -121,6 +127,7 @@ class AppConfig(BaseModel):
"""Nested Pydantic model for the entire configuration."""

api: ApiConfig
cli: CliConfig
git: GitConfig
md: MarkdownConfig
paths: PathsConfig
Expand Down
4 changes: 2 additions & 2 deletions readmeai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
def main(
api_key: str,
badges: str,
encoding: str,
endpoint: str,
emojis: bool,
offline_mode: bool,
model: str,
output: str,
Expand All @@ -40,6 +39,7 @@ def main(
config_model = AppConfigModel(app=config)
config_helper = load_config_helper(config_model)
config.api.model = model
config.cli.emojis = emojis
config.paths.output = output
config.api.temperature = temperature
config.api.offline_mode = offline_mode
Expand Down
Loading
Loading