Files
FERRUM/tab_complete.h
2025-04-28 12:35:52 +02:00

59 lines
1.7 KiB
C

/**
* tab_complete.h
* Functions for tab completion and path suggestions
*/
#ifndef TAB_COMPLETE_H
#define TAB_COMPLETE_H
#include "common.h"
/**
* Command context structure
*/
typedef struct {
int is_after_pipe; // Flag if cursor is right after a pipe
int is_filter_command; // Flag if current command is a filter command
char cmd_before_pipe[64]; // Command before the pipe
char filter_command[64]; // Current filter command
char current_token[1024]; // Current token being typed
int token_position; // Position within current token
int token_index; // Index of current token in command
int filter_arg_index; // Argument index for filter command
int has_current_field; // Flag if current field is set
int has_current_operator; // Flag if current operator is set
char current_field[64]; // Current field if known
char current_operator[16]; // Current operator if known
} CommandContext;
typedef enum {
ARG_TYPE_ANY, // Any argument
ARG_TYPE_FILE, // Files only
ARG_TYPE_DIRECTORY, // Directories only
ARG_TYPE_BOOKMARK, // Bookmark names
ARG_TYPE_ALIAS, // Alias names
ARG_TYPE_BOTH, // Both files and directories
ARG_TYPE_FAVORITE_CITY,
ARG_TYPE_THEME,
} ArgumentType;
/**
* Structure for command argument type information
*/
typedef struct {
char *command; // Command name
ArgumentType arg_type; // Expected argument type
char *description; // Optional description
} CommandArgInfo;
// Main tab completion function
char *get_tab_completion(const char *buffer);
// Initialize tab completion system
void init_tab_completion(void);
// Shutdown tab completion system
void shutdown_tab_completion(void);
#endif // TAB_COMPLETE_H