mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-08-28 02:24:12 -05:00
fix todoman failing tests and crashing main command
This commit is contained in:
Generated
+13
-13
@@ -33,11 +33,11 @@
|
||||
},
|
||||
"hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1635449388,
|
||||
"narHash": "sha256-i7hMiAgpRTGsMPTQKuNCDfW/ftQ+g9N6iaMj+RN6yws=",
|
||||
"lastModified": 1636317251,
|
||||
"narHash": "sha256-u1cWvvtGH5mfGkeIKrqw2usk4IL7wDiRcnJkUSiZq3Q=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "518b9c2159e7d4b7696ee18b8828f9086012923b",
|
||||
"rev": "fd6f34afcf062761fb5035230f6297752bfedcba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -53,11 +53,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1635672778,
|
||||
"narHash": "sha256-WW1Gew3tL0ScjTre5hSWlpKy27c1huLCLweS63u9Wv4=",
|
||||
"lastModified": 1636520380,
|
||||
"narHash": "sha256-gBiQ8+AQG6Dia34rqJDuqs6VFe/J1SjIhOZBeTXCKQI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "275f955db979e069fbe7a1fd7cfcb5ec030a2096",
|
||||
"rev": "1e5c8e9bff00d0844bc3d25d1a98eab5633e600b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -98,27 +98,27 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1635403963,
|
||||
"narHash": "sha256-0actzfzBAXvvDJ/EvPSGbtCPXUwSObQrcq0RpsPWZgA=",
|
||||
"lastModified": 1636516873,
|
||||
"narHash": "sha256-Pc++wZhO39do7i0zs1ERnm0OivhYUU5MZuMW0OIns6Y=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2deb07f3ac4eeb5de1c12c4ba2911a2eb1f6ed61",
|
||||
"rev": "04cf6dc67f8e29bd086ebd1dc9ad7c8262913347",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04cf6dc67f8e29bd086ebd1dc9ad7c8262913347",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1635690757,
|
||||
"narHash": "sha256-k/npuiftkAtsvIo9XdYX3kTL3WbfbAHoCBZG8wOOIdQ=",
|
||||
"lastModified": 1636603669,
|
||||
"narHash": "sha256-Cl+jVGVk3E+kNYd1vuN81V5qp9nfGXz/59vtbJ2vgYY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "0f52b58dc0e602d1f0f0c83ed72b08b6c64cc206",
|
||||
"rev": "d5a42127bd1dfa76465d62d2717bdc06e12d70b7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
description = "My NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/04cf6dc67f8e29bd086ebd1dc9ad7c8262913347";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
hardware.url = "github:nixos/nixos-hardware";
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
nix-colors.flake = nix-colors;
|
||||
};
|
||||
trustedUsers = [ "root" "@wheel" ];
|
||||
package = pkgs.nix_2_4;
|
||||
package = pkgs.nixUnstable;
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes ca-references
|
||||
warn-dirty = false
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
nvim-base16 = prev.vimPlugins.nvim-base16.overrideAttrs (oldAttrs: rec {
|
||||
patches = (oldAttrs.patches or [ ]) ++ [ ./nvim-base16-more-highlights.patch ];
|
||||
});
|
||||
vim-numbertoggle = prev.vimPlugins.vim-numbertoggle.overrideAttrs (oldAttrs: rec {
|
||||
patches = (oldAttrs.patches or [ ]) ++ [ ./vim-numbertoggle-command-mode.patch ];
|
||||
});
|
||||
};
|
||||
|
||||
pass-wofi = prev.callPackage ../pkgs/pass-wofi {
|
||||
@@ -50,9 +53,13 @@
|
||||
};
|
||||
});
|
||||
|
||||
todoman = prev.todoman.overrideAttrs (oldAttrs: rec {
|
||||
patches = (oldAttrs.patches or [ ]) ++ [ ./todoman-kwargs-crash.patch ];
|
||||
});
|
||||
|
||||
# Add my patch for supporting sourcehut
|
||||
nix_2_4 = prev.nix_2_4.overrideAttrs (oldAttrs: rec {
|
||||
patches = oldAttrs.patches ++ [ ./nix-sourcehut.patch ];
|
||||
patches = (oldAttrs.patches or [ ]) ++ [ ./nix-sourcehut.patch ];
|
||||
});
|
||||
|
||||
# Don't launch discord when using discocss
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/todoman/cli.py b/todoman/cli.py
|
||||
index b3bc373..14a2be8 100644
|
||||
--- a/todoman/cli.py
|
||||
+++ b/todoman/cli.py
|
||||
@@ -626,7 +626,7 @@ def list(ctx, *args, **kwargs):
|
||||
omited by default:
|
||||
"""
|
||||
hide_list = (len([_ for _ in ctx.db.lists()]) == 1) or ( # noqa: C416
|
||||
- len(kwargs["lists"]) == 1
|
||||
+ (kwargs["lists"] and len(kwargs["lists"])) == 1
|
||||
)
|
||||
|
||||
todos = ctx.db.todos(**kwargs)
|
||||
@@ -1,84 +0,0 @@
|
||||
diff --git a/tests/test_formatter.py b/tests/test_formatter.py
|
||||
index f23de73..01c2099 100644
|
||||
--- a/tests/test_formatter.py
|
||||
+++ b/tests/test_formatter.py
|
||||
@@ -9,7 +9,7 @@ from freezegun import freeze_time
|
||||
|
||||
from tests.helpers import pyicu_sensitive
|
||||
from todoman.cli import cli
|
||||
-from todoman.formatters import rgb_to_ansi
|
||||
+from todoman.formatters import colour_to_ansi
|
||||
|
||||
|
||||
@pyicu_sensitive
|
||||
@@ -155,9 +155,11 @@ def test_formatting_parsing_consitency(default_formatter):
|
||||
assert default_formatter.parse_datetime(formatted) == dt
|
||||
|
||||
|
||||
-def test_rgb_to_ansi():
|
||||
- assert rgb_to_ansi(None) is None
|
||||
- assert rgb_to_ansi("#8ab6d") is None
|
||||
- assert rgb_to_ansi("#8ab6d2f") == "\x1b[38;2;138;182;210m"
|
||||
- assert rgb_to_ansi("red") is None
|
||||
- assert rgb_to_ansi("#8ab6d2") == "\x1b[38;2;138;182;210m"
|
||||
+def test_colour_to_ansi():
|
||||
+ assert colour_to_ansi(None) is None
|
||||
+ assert colour_to_ansi("#8ab6d") is None
|
||||
+ assert colour_to_ansi("#8ab6d2f") == "\x1b[38;2;138;182;210m"
|
||||
+ assert colour_to_ansi("red") == "\x1b[31m"
|
||||
+ assert colour_to_ansi("bright cyan") == "\x1b[36;1m"
|
||||
+ assert colour_to_ansi("rd") is None
|
||||
+ assert colour_to_ansi("#8ab6d2") == "\x1b[38;2;138;182;210m"
|
||||
diff --git a/todoman/formatters.py b/todoman/formatters.py
|
||||
index 1ec179d..bd34cfe 100644
|
||||
--- a/todoman/formatters.py
|
||||
+++ b/todoman/formatters.py
|
||||
@@ -14,8 +14,6 @@ def rgb_to_ansi(colour):
|
||||
"""
|
||||
Convert a string containing an RGB colour to ANSI escapes
|
||||
"""
|
||||
- if not colour or not colour.startswith("#"):
|
||||
- return
|
||||
|
||||
r, g, b = colour[1:3], colour[3:5], colour[5:7]
|
||||
|
||||
@@ -25,6 +23,30 @@ def rgb_to_ansi(colour):
|
||||
return "\33[38;2;{!s};{!s};{!s}m".format(int(r, 16), int(g, 16), int(b, 16))
|
||||
|
||||
|
||||
+def colour_to_ansi(colour):
|
||||
+ """
|
||||
+ Convert a string containing a colour (either RGB or a standard colour name)
|
||||
+ """
|
||||
+ if not colour:
|
||||
+ return
|
||||
+ if colour.startswith("#"):
|
||||
+ return rgb_to_ansi(colour)
|
||||
+
|
||||
+ bright = "bright" in colour
|
||||
+
|
||||
+ colour = colour.replace("bright ", "")
|
||||
+
|
||||
+ colours = [ "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" ]
|
||||
+
|
||||
+ try:
|
||||
+ ansi_number = colours.index(colour)
|
||||
+ except:
|
||||
+ return
|
||||
+
|
||||
+ suffix = ';1' if bright else ""
|
||||
+ return f"\33[3{ansi_number}{suffix}m"
|
||||
+
|
||||
+
|
||||
class DefaultFormatter:
|
||||
def __init__(
|
||||
self,
|
||||
@@ -206,7 +228,7 @@ class DefaultFormatter:
|
||||
|
||||
def format_database(self, database):
|
||||
return "{}@{}".format(
|
||||
- rgb_to_ansi(database.colour) or "", click.style(database.name)
|
||||
+ colour_to_ansi(database.colour) or "", click.style(database.name)
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/plugin/number_toggle.vim b/plugin/number_toggle.vim
|
||||
index d5dad54..80aa97e 100644
|
||||
--- a/plugin/number_toggle.vim
|
||||
+++ b/plugin/number_toggle.vim
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
augroup numbertoggle
|
||||
autocmd!
|
||||
- autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
|
||||
- autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
|
||||
+ autocmd BufEnter,FocusGained,InsertLeave,WinEnter,CmdlineLeave * if &nu && mode() != "i" | set rnu | endif
|
||||
+ autocmd BufLeave,FocusLost,InsertEnter,WinLeave,CmdlineEnter * if &nu | set nornu | redraw | endif
|
||||
augroup END
|
||||
@@ -2,10 +2,7 @@
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = {
|
||||
enable = true;
|
||||
enableFlakes = true;
|
||||
};
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
|
||||
|
||||
@@ -49,13 +49,15 @@
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# QOL
|
||||
editorconfig-vim
|
||||
registers-nvim
|
||||
vim-fugitive
|
||||
vim-illuminate
|
||||
vim-matchup
|
||||
vim-numbertoggle
|
||||
vim-surround
|
||||
{ plugin = nvim-autopairs; config = "lua require('nvim-autopairs').setup{}"; }
|
||||
{ plugin = better-escape-nvim; config = "lua require('better_escape').setup()"; }
|
||||
{ plugin = range-highlight-nvim; config = "lua require('range-highlight').setup{}"; }
|
||||
{ plugin = nvim-autopairs; config = "lua require('nvim-autopairs').setup{}"; }
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -9,14 +9,31 @@
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
lspconfig.dockerls.setup{} -- Docker
|
||||
|
||||
lspconfig.bashls.setup{} -- Bash
|
||||
lspconfig.rust_analyzer.setup{} -- Rust
|
||||
|
||||
lspconfig.rust_analyzer.setup{
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
}
|
||||
}
|
||||
}
|
||||
} -- Rust
|
||||
|
||||
lspconfig.clangd.setup{} -- C/C++
|
||||
|
||||
lspconfig.rnix.setup{} -- Nix
|
||||
|
||||
lspconfig.jsonls.setup{} -- JSON
|
||||
|
||||
lspconfig.sqls.setup{cmd = {"sqls", "-config", "sqls.yml"}} -- SQL
|
||||
|
||||
lspconfig.pylsp.setup{} -- Python
|
||||
|
||||
lspconfig.sumneko_lua.setup{cmd = {"lua-language-server"}} -- Lua
|
||||
|
||||
EOF
|
||||
|
||||
nmap gD :lua vim.lsp.buf.declaration()<CR>
|
||||
|
||||
Reference in New Issue
Block a user