superfile Project Structure Guide
superfile Project Structure Guide
Section titled “superfile Project Structure Guide”The project follows a standard Go project layout with clear separation of concerns. Here’s a detailed breakdown of the main directories and their purposes:
Core Directories
Section titled “Core Directories”src/ - Main Source Code
Section titled “src/ - Main Source Code”The main source code is organized into several key directories:
cmd/ - Entry Point
Section titled “cmd/ - Entry Point”main.go- The main entry point of the application that handles:- CLI argument parsing
- Configuration initialization
- Application startup
config/ - Configuration Management
Section titled “config/ - Configuration Management”fixed_variable.go- Contains constant values and configuration pathsicon/- Icon-related configurationfunction.go- Icon initialization and management functionsicon.go- Icon definitions and mappings
internal/ - Core Application Logic
Section titled “internal/ - Core Application Logic”Contains the main business logic of the application, organized by functionality:
Configuration & Types:
config_function.go- Configuration loading and managementconfig_type.go- Configuration-related type definitionsdefault_config.go- Default configuration valuestype.go- Core type definitions
File Operations:
file_operations.go- Basic file operation functionsfile_operations_compress.go- File compression functionalityfile_operations_extract.go- File extraction functionalityhandle_file_operations.go- File operation handlers
UI & Interaction:
handle_modal.go- Modal dialog managementhandle_panel_movement.go- Panel navigation logichandle_panel_navigation.go- Panel focus managementhandle_pinned_operations.go- Pinned items functionalitykey_function.go- Keyboard input handlingmodel.go- Core application modelmodel_render.go- UI rendering logic
Utilities:
function.go- General utility functionsget_data.go- Data retrieval functionsstring_function.go- String manipulation utilitiesstring_function_test.go- String utility testsstyle.go- UI styling definitionsstyle_function.go- UI styling functionsstring_function_test.go- String utility testsstyle.go- UI styling definitionsstyle_function.go- UI styling functions
testsuite/ - superfile’s testsuite written in Python
Section titled “testsuite/ - superfile’s testsuite written in Python”- Automatically tests superfile’s functionality.
- See
testsuite/ReadMe.mdfor more info
Code Organization Principles
Section titled “Code Organization Principles”-
Separation of Concerns:
- Configuration management is isolated in the
config/directory - Core business logic lives in
internal/ - UI-related code is separated from business logic
- Configuration management is isolated in the
-
Modular Design:
- Each file has a specific responsibility
- Related functionality is grouped together
- Clear dependencies between components
-
Testing:
- Test files are placed alongside the code they test
- Example:
string_function_test.gotestsstring_function.go
Contributing Guidelines
Section titled “Contributing Guidelines”When contributing to superfile:
-
Adding New Features:
- Place new business logic in appropriate
internal/subdirectories - Keep UI-related code separate from business logic
- Follow existing naming conventions
- Place new business logic in appropriate
-
Making Changes:
- Maintain the existing file structure
- Add tests for new functionality
- Update configuration files if needed
-
Code Style:
- Follow Go best practices
- Maintain consistent formatting
- Add appropriate documentation
This structure helps maintain code organization and makes it easier for new contributors to understand where to make changes.