🌙 LunaCLI

Command Line Interface for PostgreSQL Database Management

Overview

LunaCLI is a powerful command-line tool designed to interact with PostgreSQL databases. It allows users to connect, execute SQL commands, and configure connection settings dynamically, all from a single, intuitive interface.

🚀 Easy Setup

Quick installation and configuration

⚡ Dynamic Connection

Real-time credential management

📊 Advanced Features

Export, scheduling, and monitoring

🔄 Transaction Support

Full ACID transaction management

🎯 Key Features

Database Connectivity

Connect to PostgreSQL databases with custom credentials and dynamic port configuration

SQL Execution

Execute SQL commands directly from the CLI with table-formatted results

Transaction Management

Full support for database transactions, table management, and schema creation

Entity Management

Create, save, and clone database entities for quick terminal connections

Command History

Track and reuse previously executed commands for improved workflow

Query Scheduling

Schedule SQL queries to run at specified intervals automatically

File Operations

Execute SQL files and export table data to CSV format

Batch Operations

Multiple query execution with sequential result retrieval

Code Snippets

Save frequently used SQL commands for quick access and reuse

Monitoring

Prometheus support for query monitoring and performance tracking

📋 Prerequisites

Before running LunaCLI, ensure you have the following installed:

Java 17+

Required runtime environment

Maven

For building the project

PostgreSQL

Database connectivity

🛠️ Installation

1
Clone the repository:
git clone https://github.com/doguhannilt/LunaCLI.git
2
Navigate to project directory:
cd LunaCLI
3
Build the project:
mvn clean package
4
Run LunaCLI:
java -jar LunaCLI.jar

🚀 Usage Examples

Database Connection

luna connect postgresql username:postgres password:postgres database:managify

Port Configuration

luna port:5433

SQL Query Execution

luna select-from users

Connection Information

luna info

Query Scheduling

luna schedule command:"SELECT * FROM logs"

📖 Available Commands

begin-transaction
Start a new database transaction
commit
Commit the current transaction
rollback
Rollback the current transaction
create-table
Create a new table with specified columns
drop-table
Drop an existing table
create-schema
Create a new database schema
insert-into
Insert data into a specified table
select-from
Select data from a table with optional conditions
update
Update data in a table with conditions
delete-from
Delete data from a table with conditions
backup-database
Create a backup of the database
restore-database
Restore database from backup file
history
Display all previously executed commands
schedule
Schedule a query to run at specified intervals
export
Export query results to CSV file
execute
Execute SQL commands from a file

🔧 Development

For development purposes, you can run the project without packaging:

mvn exec:java -Dexec.mainClass="org.cli.Main"

Contributing

🚀 Get Started with LunaCLI

Experience powerful PostgreSQL database management directly from your command line