intelli_shell/lib.rs
1//! _Like IntelliSense, but for shells!_
2//!
3//! 
4//!
5//! IntelliShell is a command-line tool that acts as a smart bookmark manager.
6//! It helps you find, organize, and reuse complex shell commands without ever leaving your terminal.
7//!
8//! # Features
9//!
10//! - **Standalone & Dependency-Free**: Distributed as a single binary with no external runtimes or dependencies
11//! - **Seamless Shell Integration**: Search commands with `ctrl+space` or bookmark them with `ctrl+b`
12//! - **Flexible Interface**: Choose between a non-intrusive (inline) or an immersive (full-screen) TUI
13//! - **Dynamic Variables**: Create command templates with `{{variables}}` and replace them on the fly
14//! - **Highly Configurable**: Tailor search modes, keybindings, themes, and even search-ranking algorithms
15//! - **Workspace-Aware Commands**: Automatically discovers and loads commands from your workspace's directory
16//! - **Import/Export**: Share your command library by importing or exporting to files, HTTP endpoints, or even Gists
17//! - **TLDR Integration**: Fetch and import command examples from [tldr](https://github.com/tldr-pages/tldr) pages
18//!
19//! To get started, check out the [repository](https://github.com/lasantosr/intelli-shell) or read the
20//! [IntelliShell Book](https://lasantosr.github.io/intelli-shell/) for comprehensive guides and examples.
21
22/// Configuration management for the application.
23///
24/// This module handles loading, parsing, and providing access to the application's configuration settings.
25pub mod config;
26
27/// Tracing and logs management for the application.
28///
29/// This module is responsible for setting up and configuring the application's logging system using the `tracing`
30/// crate.
31///
32/// It initializes a subscriber that directs logs to a dedicated log file within the application's data directory.
33pub mod logging;
34
35/// Centralized error and panic handling for the application.
36///
37/// This module sets up enhanced error reporting using `color-eyre` and configures custom panic hooks.
38///
39/// It ensures that errors and panics are gracefully handled, logged to the designated log file, and presented to the
40/// user.
41pub mod errors;
42
43/// Provides a Terminal User Interface (TUI) management system.
44///
45/// This module orchestrates the TUI lifecycle, including terminal setup (raw mode, alternate screen or inline display),
46/// event handling (keyboard, mouse, paste, resize, focus, periodic ticks, and renders), and rendering the user
47/// interface.
48///
49/// It manages the event loop and provides mechanisms to enter and exit the TUI cleanly, restoring the terminal to its
50/// original state.
51pub mod tui;
52
53/// Defines and parses the command-line interface (CLI) for the application.
54///
55/// This module uses the `clap` crate to define the structure of the CLI, including subcommands, arguments, and help
56/// messages. It handles parsing command-line arguments provided by the user into a structured format that the
57/// application can easily process.
58///
59/// It is the primary entry point for interacting with the application via the command line.
60pub mod cli;
61
62/// Contains the main application logic and orchestration.
63///
64/// This module defines the `App` struct, which serves as the central coordinator for the application. It holds the
65/// application's configuration and manages the overall program flow based on the parsed command-line arguments.
66///
67/// It dispatches execution to specific processes (interactive or non-interactive) and, for interactive processes,
68/// manages the Terminal User Interface (TUI) lifecycle, handles events, and processes user actions.
69pub mod app;
70
71/// Defines and implements the distinct operational processes or commands the application can run.
72///
73/// This module provides traits (`Process`, `InteractiveProcess`) to abstract the concept of an executable task within
74/// the application, differentiating between those that run non-interactively and those that require a Terminal User
75/// Interface.
76///
77/// It also defines the standard structure for process output (`ProcessOutput`) and contains the specific
78/// implementations of these processes.
79pub mod process;
80
81/// Provides the building blocks and interface for interactive Terminal User Interface (TUI) elements.
82///
83/// This module defines the `Component` trait, which is the fundamental interface for any UI element that can be
84/// displayed within the TUI.
85///
86/// Components are responsible for rendering themselves, processing user input events (keyboard, mouse, paste), managing
87/// their internal state, and performing periodic updates.
88///
89/// This module also serves as a container for specific concrete component implementations used by interactive
90/// processes.
91pub mod component;
92
93/// Contains custom implementations of [`ratatui`] widgets used by components.
94pub mod widgets;
95
96/// Defines the core data structures and models for the application's business domain.
97///
98/// This module serves as a central collection point and namespace for the fundamental data types that represent the key
99/// entities and concepts within the application, such as commands and their associated variables.
100pub mod model;
101
102/// Encapsulates the core business logic and operations of the application.
103///
104/// This module contains the implementation of the application's key functionalities, acting upon the data models
105/// defined in the `model` module.
106///
107/// It orchestrates interactions with the `storage` layer to persist and retrieve data and provides the necessary
108/// operations consumed by the `process` and potentially other layers.
109pub mod service;
110
111/// Provides the data access layer for the application, abstracting the underlying storage implementation.
112///
113/// This module is responsible for interacting with the persistent data store (currently SQLite).
114///
115/// It defines the `SqliteStorage` struct and methods for database initialization, applying migrations, and performing
116/// data operations related to the application's models.
117pub mod storage;
118
119/// Provides various utility functions and extension traits for common tasks.
120///
121/// This module contains general-purpose helpers that don't fit neatly into other domain-specific modules. This includes
122/// functions for string manipulation, as well as potentially other reusable components or patterns.
123pub mod utils;