Skip to content

Commit

Permalink
docs: clean up README.md, LICENSE and .gitignore (#10)
Browse files Browse the repository at this point in the history
This commit updates README.md,
adds e-mail to LICENSE,
and updates comments in .gitignore.
  • Loading branch information
schneiderfelipe committed Mar 28, 2023
1 parent 985e073 commit 30cb138
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 21 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
# Generated by Cargo
# will have compiled files and executables
debug/
# Remove target directory
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
# Remove backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
# Remove debugging information generated by MSVC Windows builds of rustc
*.pdb

# End of https://www.toptal.com/developers/gitignore/api/rust
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Felipe S. S. Schneider
Copyright (c) 2023 Felipe S. S. Schneider <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# cligpt

`cligpt` is a command-line interface for interacting with the `ChatGPT` API from `OpenAI`.
`cligpt` is a command-line interface for interacting
with the `ChatGPT` API from `OpenAI`.
With `cligpt`,
you can quickly and easily generate text by sending prompts to `ChatGPT` from your terminal.
you can quickly and easily generate text by sending prompts to `ChatGPT`
from your terminal.
Simply provide your `OpenAI` API key and the message you want to generate,
and `cligpt` will handle the rest.

`cligpt` is written in [Rust](https://www.rust-lang.org/) and uses the clap and `cligpt` crates to provide a user-friendly interface for the `ChatGPT` API.
It's perfect for developers who want to quickly prototype text generation applications or for anyone who wants to experiment with the power of the `ChatGPT` API from the comfort of their terminal.
`cligpt` is written in [Rust](https://www.rust-lang.org/) and uses the
[`clap`](https://github.com/clap-rs/clap)
and
[`async-openai`](https://github.com/64bit/async-openai) crates
to provide a user-friendly interface for the `ChatGPT` API.
It's perfect for developers who want
to quickly prototype text generation applications
or for anyone who wants to experiment with the power of the `ChatGPT` API
from the comfort of their terminal.

## Installation

### Requirements

Before installing `cligpt`,
you need to make sure you have [Rust](https://www.rust-lang.org/tools/install) (version 1.65.0 or later)
you need to make sure you have
[Rust](https://www.rust-lang.org/tools/install) (version 1.65.0 or later)
and [Cargo](https://doc.rust-lang.org/cargo/),
the package manager for Rust,
installed.
Expand All @@ -37,15 +47,17 @@ you can run `cligpt` by typing `cligpt` in your terminal.
### Directly from [GitHub](https://github.com/schneiderfelipe/cligpt)

Alternatively,
you can install `cligpt` directly from the GitHub repository using Cargo by running:
you can install `cligpt` directly from the GitHub repository
using Cargo by running:

```bash
cargo install --git=https://github.com/schneiderfelipe/cligpt.git
```

### By cloning the GitHub repository

You can also build `cligpt` from source by cloning the GitHub repository and running `cargo build`:
You can also build `cligpt` from source by cloning the GitHub repository
and running `cargo build`:

```bash
git clone https://github.com/schneiderfelipe/cligpt.git
Expand All @@ -63,7 +75,9 @@ Just run `cargo install --path=.` instead of `cargo build --release`.
## Usage

To use `cligpt`,
you need to provide your [`OpenAI` API key](https://platform.openai.com/account/api-keys) and the message you want to generate.
you need to provide your
[`OpenAI` API key](https://platform.openai.com/account/api-keys)
and the message you want to generate.
You can provide the API key using the `-k` or `--api-key` option,
or by setting the `OPENAI_API_KEY` environment variable.

Expand All @@ -73,4 +87,36 @@ Here's an example usage:
cligpt --api-key YOUR_API_KEY 'Hello, ChatGPT!'
```

This will send the message `'Hello, ChatGPT!'` to the `ChatGPT` API using your API key and print the generated text to your terminal.
This will send the message `'Hello, ChatGPT!'` to the `ChatGPT` API using
your API key and print the generated text to your terminal.

You can also specify additional options to customize the text generation,
such as temperature,
and the language model to use.

For example,
you can set the temperature to 0.9 and use GPT-4:

```bash
cligpt --temperature 0.9 --model gpt4 'Hello, ChatGPT!'
```

In the example above,
the API key will be read from the environment.

For more information on available options,
run `cligpt --help`.

## Contributing

Contributions to `cligpt` are welcome!
If you find a bug,
have a feature request,
or want to contribute code,
please [open an issue](https://github.com/schneiderfelipe/cligpt/issues/new)
or [a pull request](https://github.com/schneiderfelipe/cligpt/pulls)
on the [GitHub repository](https://github.com/schneiderfelipe/cligpt).

## License

`cligpt` is released under the [MIT License](LICENSE).
64 changes: 55 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
//! `cligpt` is a command-line interface for interacting with the `ChatGPT` API from `OpenAI`.
//! `cligpt` is a command-line interface for interacting
//! with the `ChatGPT` API from `OpenAI`.
//! With `cligpt`,
//! you can quickly and easily generate text by sending prompts to `ChatGPT` from your terminal.
//! you can quickly and easily generate text by sending prompts to `ChatGPT`
//! from your terminal.
//! Simply provide your `OpenAI` API key and the message you want to generate,
//! and `cligpt` will handle the rest.
//!
//! `cligpt` is written in [Rust](https://www.rust-lang.org/) and uses the clap and `cligpt` crates to provide a user-friendly interface for the `ChatGPT` API.
//! It's perfect for developers who want to quickly prototype text generation applications or for anyone who wants to experiment with the power of the `ChatGPT` API from the comfort of their terminal.
//! `cligpt` is written in [Rust](https://www.rust-lang.org/) and uses the
//! [`clap`](https://github.com/clap-rs/clap)
//! and
//! [`async-openai`](https://github.com/64bit/async-openai) crates
//! to provide a user-friendly interface for the `ChatGPT` API.
//! It's perfect for developers who want
//! to quickly prototype text generation applications
//! or for anyone who wants to experiment with the power of the `ChatGPT` API
//! from the comfort of their terminal.
//!
//! # Installation
//!
//! ## Requirements
//!
//! Before installing `cligpt`,
//! you need to make sure you have [Rust](https://www.rust-lang.org/tools/install) (version 1.65.0 or later)
//! you need to make sure you have
//! [Rust](https://www.rust-lang.org/tools/install) (version 1.65.0 or later)
//! and [Cargo](https://doc.rust-lang.org/cargo/),
//! the package manager for Rust,
//! installed.
Expand All @@ -35,15 +45,17 @@
//! ## Directly from [GitHub](https://github.com/schneiderfelipe/cligpt)
//!
//! Alternatively,
//! you can install `cligpt` directly from the GitHub repository using Cargo by running:
//! you can install `cligpt` directly from the GitHub repository
//! using Cargo by running:
//!
//! ```bash
//! cargo install --git=https://github.com/schneiderfelipe/cligpt.git
//! ```
//!
//! ## By cloning the GitHub repository
//!
//! You can also build `cligpt` from source by cloning the GitHub repository and running `cargo build`:
//! You can also build `cligpt` from source by cloning the GitHub repository
//! and running `cargo build`:
//!
//! ```bash
//! git clone https://github.com/schneiderfelipe/cligpt.git
Expand All @@ -61,7 +73,9 @@
//! # Usage
//!
//! To use `cligpt`,
//! you need to provide your [`OpenAI` API key](https://platform.openai.com/account/api-keys) and the message you want to generate.
//! you need to provide your
//! [`OpenAI` API key](https://platform.openai.com/account/api-keys)
//! and the message you want to generate.
//! You can provide the API key using the `-k` or `--api-key` option,
//! or by setting the `OPENAI_API_KEY` environment variable.
//!
Expand All @@ -71,7 +85,39 @@
//! cligpt --api-key YOUR_API_KEY 'Hello, ChatGPT!'
//! ```
//!
//! This will send the message `'Hello, ChatGPT!'` to the `ChatGPT` API using your API key and print the generated text to your terminal.
//! This will send the message `'Hello, ChatGPT!'` to the `ChatGPT` API using
//! your API key and print the generated text to your terminal.
//!
//! You can also specify additional options to customize the text generation,
//! such as temperature,
//! and the language model to use.
//!
//! For example,
//! you can set the temperature to 0.9 and use GPT-4:
//!
//! ```bash
//! cligpt --temperature 0.9 --model gpt4 'Hello, ChatGPT!'
//! ```
//!
//! In the example above,
//! the API key will be read from the environment.
//!
//! For more information on available options,
//! run `cligpt --help`.
//!
//! # Contributing
//!
//! Contributions to `cligpt` are welcome!
//! If you find a bug,
//! have a feature request,
//! or want to contribute code,
//! please [open an issue](https://github.com/schneiderfelipe/cligpt/issues/new)
//! or [a pull request](https://github.com/schneiderfelipe/cligpt/pulls)
//! on the [GitHub repository](https://github.com/schneiderfelipe/cligpt).
//!
//! # License
//!
//! `cligpt` is released under the [MIT License](LICENSE).
use std::{
io::{self, Read, Write},
Expand Down

0 comments on commit 30cb138

Please sign in to comment.