Skip to content
/ bmi Public

This is a command-line interface (CLI) tool for calculating body mass index (BMI) based on user input for weight and height.

License

Notifications You must be signed in to change notification settings

k1lgor/bmi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BMI Calculator

Overview

This is a command-line and text-based UI (TUI) tool for calculating Body Mass Index (BMI) based on user input for weight and height. It supports multiple units, offers detailed BMI categorization, and includes versioning.

Features

  • CLI: Run via the command line with unit support for kg/lbs and cm/in.
  • TUI: Interactive text-based UI using tview.
  • Web Interface: Simple web version built with Gin framework, offering a user-friendly web form.
  • Versioning: Display version info using --version.
  • Unit Testing: Built-in tests using Go’s testing framework.

Installation

  1. Clone the repository:
git clone https://github.com/k1lgor/bmi
cd bmi
  1. Install dependencies (for TUI and Web):
go get github.com/rivo/tview
go get github.com/gin-gonic/gin
  1. Build the project:
go build -o bmi ./cmd/bmi

Usage

  • CLI
./bmi 70 kg 170 cm
  • TUI
./bmi -tui
  • Web
./bmi -web

Then open your browser at http://localhost:8080.

  • Version
./bmi -version

Project Structure

bmi/ │ ├── cmd/ │ └── bmi/ │ └── main.go # CLI and TUI entry point │ ├── pkg/ │ ├── bmi/ │ │ ├── bmi.go # Core BMI logic │ │ └── bmi_test.go # Unit tests for BMI │ └── input/ │ └── input.go # Input parsing and validation │ ├── ui/ │ └── tui.go # TUI logic for text-based interface │ ├── web/ │ ├── web.go # Web server logic using Gin │ └── templates/ │ └── index.html # Web form UI │ └── go.mod # Go module file

About

This is a command-line interface (CLI) tool for calculating body mass index (BMI) based on user input for weight and height.

Resources

License

Stars

Watchers

Forks

Packages

No packages published