Add mycli

This commit is contained in:
Jakob Lechner 2024-07-18 19:32:42 +02:00
parent 37221ed58d
commit 82d16eb239
3 changed files with 157 additions and 0 deletions

View file

@ -21,6 +21,7 @@
./kicad.nix
./mpv.nix
./mute-indicator.nix
./mycli.nix
./neo.nix
./neovim.nix
./nix-index.nix

View file

@ -33,6 +33,12 @@ let
target = "theme.css";
exec = [ "${pkgs.systemd}/bin/systemctl" "--user" "restart" "waybar.service" ];
}
{
dir = "~/.config/mycli";
light = "theme-light.ini";
dark = "theme-dark.ini";
target = "myclirc";
}
{
exec = (
if nixosConfig.jalr.gui.enable

View file

@ -0,0 +1,150 @@
{ lib, pkgs, ... }:
let
quoteValues = ini: lib.mapAttrs
(section: attrs:
lib.mapAttrs (key: value: if builtins.isString value then ''"${value}"'' else value) attrs
)
ini;
solarized = import ./solarized.nix;
config = {
main = {
# Enables context sensitive auto-completion. If this is disabled the all
# possible completions will be listed.
smart_completion = true;
# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple
# lines. End of line (return) is considered as the end of the statement.
multi_line = false;
# Destructive warning mode will alert you before executing a sql statement
# that may cause harm to the database such as "drop table", "drop database"
# or "shutdown".
destructive_warning = true;
# log_file location.
log_file = "~/.mycli.log";
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG". "NONE" disables logging.
log_level = "INFO";
# Log every query and its results to a file. Enable this by uncommenting the
# line below.
# audit_log = "~/.mycli-audit.log";
# Timing of sql statments and table rendering.
timing = true;
# Table format. Possible values: ascii, double, github,
# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,
# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.
# Recommended: ascii
table_format = "ascii";
# Syntax coloring style. Possible values (many support the "-dark" suffix):
# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,
# fruity.
# Screenshots at http://mycli.net/syntax
# Can be further modified in [colors]
syntax_style = "native";
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = "emacs";
# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.
wider_completion_menu = false;
# MySQL prompt
# \D - The full current date
# \d - Database name
# \h - Hostname of the server
# \m - Minutes of the current time
# \n - Newline
# \P - AM/PM
# \p - Port
# \R - The current time, in 24-hour military time (023)
# \r - The current time, standard 12-hour time (112)
# \s - Seconds of the current time
# \t - Product type (Percona, MySQL, MariaDB)
# \A - DSN alias name (from the [alias_dsn] section)
# \u - Username
# \x1b[...m - insert ANSI escape sequence
prompt = "\\u@\\A:\\d> ";
prompt_continuation = "-> ";
# Skip intro info on startup and outro info on exit
less_chatty = false;
# Use alias from --login-path instead of host name in prompt
login_path_as_host = false;
# Cause result sets to be displayed vertically if they are too wide for the current window,
# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)
auto_vertical_output = false;
# keyword casing preference. Possible values "lower", "upper", "auto"
keyword_casing = "upper";
# disabled pager on startup
enable_pager = true;
};
# Favorite queries.
favorite_queries = { };
# Use the -d option to reference a DSN.
# Special characters in passwords and other strings can be escaped with URL encoding.
alias_dsn = {
# example_dsn = "mysql://[user[:password]@][host][:port][/dbname]";
};
};
colors = {
common = {
"sql.datatype" = "nobold ${solarized.yellow.hex}";
"sql.function" = "bg:#FF0000 #0000FF";
"sql.keyword" = "${solarized.green.hex}";
"sql.literal" = solarized.green.hex;
"sql.number" = solarized.cyan.hex;
"sql.string" = solarized.cyan.hex;
};
light = {
"prompt" = "bg:${solarized.blue.hex} ${solarized.base02.hex}";
"selected" = "bg:${solarized.base2.hex} ${solarized.base00.hex}";
"sql.comment" = "italic ${solarized.base1.hex}";
"sql.operator" = "${solarized.base02.hex}";
"sql.punctuation" = "${solarized.base01.hex}";
"sql.symbol" = "${solarized.base01.hex}";
};
dark = {
"prompt" = "bg:${solarized.blue.hex} ${solarized.base2.hex}";
"selected" = "bg:${solarized.base02.hex} ${solarized.base0.hex}";
"sql.comment" = "italic ${solarized.base01.hex}";
"sql.operator" = "${solarized.base2.hex}";
"sql.punctuation" = "${solarized.base1.hex}";
"sql.symbol" = "${solarized.base1.hex}";
};
};
in
{
home.packages = with pkgs; [
mycli
];
xdg.configFile = lib.attrsets.mapAttrs'
(
name: value: lib.attrsets.nameValuePair "mycli/theme-${name}.ini" {
text = lib.generators.toINI { } (quoteValues (config // { colors = value; }));
}
)
{
light = colors.common // colors.light;
dark = colors.common // colors.dark;
};
}