updated folder structure once more
This commit is contained in:
63
include/data/aliases.h
Normal file
63
include/data/aliases.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* aliases.h
|
||||
* Definitions for shell alias functionality
|
||||
*/
|
||||
|
||||
#ifndef ALIASES_H
|
||||
#define ALIASES_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Structure to represent an alias
|
||||
typedef struct AliasEntry {
|
||||
char *name; // Alias name (command to type)
|
||||
char *command; // The command it expands to
|
||||
} AliasEntry;
|
||||
|
||||
// Initialize alias system
|
||||
void init_aliases(void);
|
||||
|
||||
// Clean up alias system
|
||||
void cleanup_aliases(void);
|
||||
|
||||
// Shutdown the alias system
|
||||
void shutdown_aliases(void);
|
||||
|
||||
// Load aliases from file
|
||||
int load_aliases(void);
|
||||
|
||||
// Save aliases to file
|
||||
int save_aliases(void);
|
||||
|
||||
// Add a new alias
|
||||
int add_alias(const char *name, const char *command);
|
||||
|
||||
// Remove an alias
|
||||
int remove_alias(const char *name);
|
||||
|
||||
// Find an alias by name
|
||||
AliasEntry* find_alias(const char *name);
|
||||
|
||||
// Expand a command line by replacing aliases
|
||||
char* expand_aliases(const char *command);
|
||||
|
||||
// Command handler for the "alias" command
|
||||
int lsh_alias(char **args);
|
||||
|
||||
// Command handler for the "unalias" command
|
||||
int lsh_unalias(char **args);
|
||||
|
||||
// Command handler to list all aliases
|
||||
int lsh_aliases(char **args);
|
||||
|
||||
// Get alias names for tab completion
|
||||
char** get_alias_names(int *count);
|
||||
|
||||
// Expand alias in args array
|
||||
char** expand_alias(char **args);
|
||||
|
||||
// Global variables for alias storage
|
||||
extern AliasEntry *aliases;
|
||||
extern int alias_count;
|
||||
|
||||
#endif // ALIASES_H
|
||||
57
include/data/bookmarks.h
Normal file
57
include/data/bookmarks.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* bookmarks.h
|
||||
* Functions for managing directory bookmarks
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKS_H
|
||||
#define BOOKMARKS_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Structure to represent a bookmark
|
||||
typedef struct {
|
||||
char *name; // Bookmark name
|
||||
char *path; // Directory path
|
||||
} BookmarkEntry;
|
||||
|
||||
// Initialize bookmark system
|
||||
void init_bookmarks(void);
|
||||
|
||||
// Clean up bookmark system
|
||||
void cleanup_bookmarks(void);
|
||||
|
||||
// Shutdown the bookmark system
|
||||
void shutdown_bookmarks(void);
|
||||
|
||||
// Load bookmarks from file
|
||||
int load_bookmarks(void);
|
||||
|
||||
// Save bookmarks to file
|
||||
int save_bookmarks(void);
|
||||
|
||||
// Add a new bookmark
|
||||
int add_bookmark(const char *name, const char *path);
|
||||
|
||||
// Remove a bookmark by name
|
||||
int remove_bookmark(const char *name);
|
||||
|
||||
// Find a bookmark by name
|
||||
BookmarkEntry *find_bookmark(const char *name);
|
||||
|
||||
// Command handlers
|
||||
int lsh_bookmark(char **args); // Add a bookmark
|
||||
int lsh_bookmarks(char **args); // List all bookmarks
|
||||
int lsh_goto(char **args); // Jump to a bookmark
|
||||
int lsh_unbookmark(char **args); // Remove a bookmark
|
||||
|
||||
// Get bookmarked directories for tab completion
|
||||
char **get_bookmark_names(int *count);
|
||||
|
||||
// Find a matching bookmark by partial name
|
||||
char *find_matching_bookmark(const char *partial_name);
|
||||
|
||||
// Global bookmarks array
|
||||
extern BookmarkEntry *bookmarks;
|
||||
extern int bookmark_count;
|
||||
|
||||
#endif // BOOKMARKS_H
|
||||
50
include/data/favorite_cities.h
Normal file
50
include/data/favorite_cities.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* favorite_cities.h
|
||||
* Functions for managing favorite cities for weather lookups
|
||||
*/
|
||||
|
||||
#ifndef FAVORITE_CITIES_H
|
||||
#define FAVORITE_CITIES_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Structure to represent a favorite city
|
||||
typedef struct {
|
||||
char name[128]; // City name
|
||||
} CityEntry;
|
||||
|
||||
// Initialize favorite cities system
|
||||
void init_favorite_cities(void);
|
||||
|
||||
// Clean up favorite cities system
|
||||
void cleanup_favorite_cities(void);
|
||||
|
||||
// Shutdown favorite cities system (save and cleanup)
|
||||
void shutdown_favorite_cities(void);
|
||||
|
||||
// Load favorite cities from file
|
||||
int load_favorite_cities(void);
|
||||
|
||||
// Save favorite cities to file
|
||||
int save_favorite_cities(void);
|
||||
|
||||
// Add a new favorite city
|
||||
int add_favorite_city(const char *name);
|
||||
|
||||
// Remove a favorite city
|
||||
int remove_favorite_city(const char *name);
|
||||
|
||||
// Find a favorite city by name
|
||||
CityEntry *find_favorite_city(const char *name);
|
||||
|
||||
// Get favorite city names for tab completion
|
||||
char **get_favorite_city_names(int *count);
|
||||
|
||||
// Command handlers
|
||||
int lsh_cities(char **args); // Main cities command handler
|
||||
|
||||
// Global favorite cities array
|
||||
extern CityEntry *favorite_cities;
|
||||
extern int favorite_city_count;
|
||||
|
||||
#endif // FAVORITE_CITIES_H
|
||||
70
include/data/structured_data.h
Normal file
70
include/data/structured_data.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* structured_data.h
|
||||
* Definitions for structured data representation and manipulation
|
||||
*/
|
||||
|
||||
#ifndef STRUCTURED_DATA_H
|
||||
#define STRUCTURED_DATA_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Value types for structured data
|
||||
typedef enum {
|
||||
TYPE_STRING,
|
||||
TYPE_INT,
|
||||
TYPE_FLOAT,
|
||||
TYPE_SIZE // Special type for file sizes with units
|
||||
} ValueType;
|
||||
|
||||
// A single data value that can be of different types
|
||||
typedef struct {
|
||||
ValueType type;
|
||||
union {
|
||||
char *str_val;
|
||||
int int_val;
|
||||
float float_val;
|
||||
struct {
|
||||
double value;
|
||||
char unit[8];
|
||||
} size_val;
|
||||
} value;
|
||||
int is_highlighted; // Flag for highlighting in tables
|
||||
} DataValue;
|
||||
|
||||
// Table structure to hold rows and columns of data
|
||||
typedef struct {
|
||||
char **headers; // Column names
|
||||
int header_count; // Number of columns
|
||||
DataValue **rows; // Array of rows (each row is an array of DataValues)
|
||||
int row_count; // Current number of rows
|
||||
int row_capacity; // Allocated capacity for rows
|
||||
} TableData;
|
||||
|
||||
// Function to create a new table with the given headers
|
||||
TableData* create_table(char **headers, int header_count);
|
||||
|
||||
// Function to add a row to a table
|
||||
void add_table_row(TableData *table, DataValue *row);
|
||||
|
||||
// Function to free all memory associated with a table
|
||||
void free_table(TableData *table);
|
||||
|
||||
// Function to create a copy of a DataValue
|
||||
DataValue copy_data_value(const DataValue *src);
|
||||
|
||||
// Function to free a DataValue
|
||||
void free_data_value(DataValue *value);
|
||||
|
||||
// Function to filter a table based on a condition
|
||||
TableData* filter_table(TableData *input, char *field, char *op, char *value);
|
||||
|
||||
// Function to print a table to the console
|
||||
void print_table(TableData *table);
|
||||
|
||||
// Function to parse human-readable sizes
|
||||
long parse_size(const char *size_str);
|
||||
|
||||
// Function to extract size in bytes from a formatted size string
|
||||
long extract_size_bytes(const char *size_str);
|
||||
|
||||
#endif // STRUCTURED_DATA_H
|
||||
Reference in New Issue
Block a user