Skip to content

Commit

Permalink
docs: updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Saphereye committed Jun 25, 2024
1 parent 90920c8 commit eb80b36
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 30 deletions.
26 changes: 16 additions & 10 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lan-chat"
version = "0.12.5"
version = "0.12.6"
edition = "2021"
authors = ["Saphereye <[email protected]>"]
license = "MIT"
Expand All @@ -21,7 +21,7 @@ repository = "https://github.com/Saphereye/lan-chat"

[dependencies]
crossterm = "0.27.0"
if-addrs = "0.10.1"
if-addrs = "0.13.0"
ratatui = "0.26.0"
tui-textarea = "0.4.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Lan Chat ![crates.io](https://img.shields.io/crates/v/lan-chat.svg) ![Build Passing](https://github.com/Saphereye/lan-chat/actions/workflows/rust.yml/badge.svg)

![Running example](https://github.com/Saphereye/lan-chat/blob/main/assets/example.png)

Lan Chat is a terminal-based chat application featuring a user-friendly terminal interface.

## Installation
Expand Down Expand Up @@ -44,7 +46,9 @@ lan-chat -s <server-ip> -p <pseudonym>

4. To insert emojis in the chat, use the following format: `:<emoji name>:`. For example is you type `That's funny :laughing:` it will be rendered as `That's funny 😂`.

The supported emojis are as follows
The supported emojis are as follows\\


| Command | Emoji |
|-------------|-------|
| `:smile:` | 😊 |
Expand All @@ -53,7 +57,3 @@ The supported emojis are as follows
| `:cry: ` | 😢 |

For all codes please refer to [Emoji Cheat Sheet](https://github.com/ikatyang/emoji-cheat-sheet/tree/master).

## Running Example

![image](https://github.com/Saphereye/lan-chat/assets/59739923/daada2ff-4cf0-4251-8e91-92b867f1c2bc)
Binary file added assets/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/lib.rs

This file was deleted.

19 changes: 8 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
//! A simple chat application.
//!
//! The application uses a client-server model where many clients are connected to a single server.
//! When the user sends a message to server using TCP, its broadcasted to all the connected clients.
//! The chat application uses a terminal based interface to allow usage even in the absence of a GUI.
#![doc = include_str!("../README.md")]

use clap::Parser;
use env_logger::Builder;
use lan_chat::networking::client::run_client;
use lan_chat::networking::messaging::MessageType;
use lan_chat::networking::server::{get_local_ipv4, run_server};
use lan_chat::tui_handler::{handle_events, ui, MAX_NAME_LENGTH};
use crate::networking::client::run_client;
use crate::networking::messaging::MessageType;
use crate::networking::server::{get_local_ipv4, run_server};
use crate::tui_handler::{handle_events, ui, MAX_NAME_LENGTH};
use log::*;
use std::io::{self, stdout};
use std::net::TcpStream;
use std::sync::{Arc, Mutex};
mod networking;
mod tui_handler;

use crossterm::{
event::{DisableMouseCapture, EnableMouseCapture},
Expand All @@ -22,8 +20,7 @@ use crossterm::{
use ratatui::prelude::*;
use tui_textarea::TextArea;

/// The main function of the application.
/// It is responsible for parsing the command line arguments and starting the server or client based on the arguments.
/// Defines the command line arguments used by clap crate.
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
Expand Down
2 changes: 2 additions & 0 deletions src/networking/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Contains logic for network communication between clients and the server.
pub mod client;
pub mod messaging;
pub mod server;
1 change: 1 addition & 0 deletions src/tui_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use tui_textarea::{Input, Key, TextArea};

use crate::networking::messaging::{send_message, MessageType};

/// The maximum length of the name of the user.
pub const MAX_NAME_LENGTH: usize = 10;

/// Handles the events for the UI. Returns true if the user wants to quit the application.
Expand Down

0 comments on commit eb80b36

Please sign in to comment.