How anrighe/smile works
SMILE is a shell command-not-found suggestion engine. The documented workflow starts when the shell cannot resolve a command, invokes SMILE with the misspelled name, scans configured PATH directories for executables, optionally filters candidates, calculates Damerau–Levenshtein distances, and prints the closest suggestions. Configuration and optional history storage are supporting capabilities. The initializer-to-program link is documented in the README; the initializer script itself was not sampled.
Main entry points: main.cpp Suggestion workflow · Settings.hpp Settings loader · command_not_found_handle.sh Not-found handler · DatabaseStatements.hpp History SQL
Components 11
Shell entry
- Not-found handler
initializer/command_not_found_handle.sh - CLI entry
src/main.cpp
Command matching
- Suggestion workflow
src/main.cpp - Executable scanner
include/CommonUtils.hpp - Candidate filter
src/main.cpp - Edit distance
include/WordDistanceHandler.hpp - Suggestion output
src/main.cpp
Configuration and history
- Settings loader
include/Settings.hpp - History SQL
include/DatabaseStatements.hpp - SQLite history
Other components
- Bash shell
Connections 11
- Bash shell → Not-found handler: unresolved command
README.md - Not-found handler → CLI entry: runs SMILE
README.md - CLI entry → Settings loader: loads settings
src/main.cpp - CLI entry → Suggestion workflow: passes command
src/main.cpp - Suggestion workflow → Executable scanner: scans PATH
src/main.cpp - Suggestion workflow → Candidate filter: filters candidates
src/main.cpp - Suggestion workflow → Edit distance: calculates distances
src/main.cpp - Suggestion workflow → Suggestion output: prints closest
src/main.cpp - Settings loader → History SQL: creates schema query
include/Settings.hpp - Settings loader → SQLite history: opens and creates
include/Settings.hpp - History SQL → SQLite history: prepares SQL
include/DatabaseStatements.hpp