hctx

package
v0.0.0-...-7ae9f15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigCtxKey  hishtoryContextKey = "config"
	DbCtxKey      hishtoryContextKey = "db"
	HomedirCtxKey hishtoryContextKey = "homedir"
)

Variables

This section is empty.

Functions

func GetConfigContents

func GetConfigContents() ([]byte, error)

func GetDb

func GetDb(ctx context.Context) *gorm.DB

func GetHome

func GetHome(ctx context.Context) string

func GetLogger

func GetLogger() *logrus.Logger

func InitConfig

func InitConfig() error

func MakeContext

func MakeContext() context.Context

func MakeHishtoryDir

func MakeHishtoryDir() error

func OpenLocalSqliteDb

func OpenLocalSqliteDb() (*gorm.DB, error)

func SetConfig

func SetConfig(config *ClientConfig) error

Types

type ClientConfig

type ClientConfig struct {
	// The user secret that is used to derive encryption keys for syncing history entries
	UserSecret string `json:"user_secret"`
	// Whether hishtory recording is enabled
	IsEnabled bool `json:"is_enabled"`
	// A device ID used to track which history entry came from which device for remote syncing
	DeviceId string `json:"device_id"`
	// Used for skipping history entries prefixed with a space in bash
	LastPreSavedHistoryLine string `json:"last_presaved_history_line"`
	// Used for skipping history entries prefixed with a space in bash
	LastSavedHistoryLine string `json:"last_saved_history_line"`
	// Used for uploading history entries that we failed to upload due to a missing network connection
	HaveMissedUploads     bool  `json:"have_missed_uploads"`
	MissedUploadTimestamp int64 `json:"missed_upload_timestamp"`
	// Used for uploading deletion requests that we failed to upload due to a missed network connection
	// Note that this is only applicable for deleting pre-saved entries. For interactive deletion, we just
	// show the user an error message if they're offline.
	PendingDeletionRequests []shared.DeletionRequest `json:"pending_deletion_requests"`
	// Used for avoiding double imports of .bash_history
	HaveCompletedInitialImport bool `json:"have_completed_initial_import"`
	// Whether control-r bindings are enabled
	ControlRSearchEnabled bool `json:"enable_control_r_search"`
	// The set of columns that the user wants to be displayed
	DisplayedColumns []string `json:"displayed_columns"`
	// Custom columns
	CustomColumns []CustomColumnDefinition `json:"custom_columns"`
	// Whether this is an offline instance of hishtory with no syncing
	IsOffline bool `json:"is_offline"`
	// Whether duplicate commands should be displayed
	FilterDuplicateCommands bool `json:"filter_duplicate_commands"`
	// A format string for the timestamp
	TimestampFormat string `json:"timestamp_format"`
	// Beta mode, enables unspecified additional beta features
	// Currently: This enables pre-saving of history entries to better handle long-running commands
	BetaMode bool `json:"beta_mode"`
	// Whether to highlight matches in search results
	HighlightMatches bool `json:"highlight_matches"`
	// Whether to enable AI completion
	AiCompletion bool `json:"ai_completion"`
	// Whether to enable presaving
	EnablePresaving bool `json:"enable_presaving"`
	// The current color scheme for the TUI
	ColorScheme ColorScheme `json:"color_scheme"`
	// A default filter that will be applied to all search queries
	DefaultFilter string `json:"default_filter"`
	// The endpoint to use for AI suggestions
	AiCompletionEndpoint string `json:"ai_completion_endpoint"`
}

func GetConf

func GetConf(ctx context.Context) *ClientConfig

func GetConfig

func GetConfig() (ClientConfig, error)

type ColorScheme

type ColorScheme struct {
	SelectedText       string
	SelectedBackground string
	BorderColor        string
}

func GetDefaultColorScheme

func GetDefaultColorScheme() ColorScheme

type CustomColumnDefinition

type CustomColumnDefinition struct {
	ColumnName    string `json:"column_name"`
	ColumnCommand string `json:"column_command"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL