1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

television: update channel location

Co-authored-by: awwpotato <awwpotato@voidq.com>
This commit is contained in:
PopeRigby 2025-08-02 10:25:35 -07:00 committed by Austin Horstman
parent d492e3c381
commit 98aed449ba
2 changed files with 56 additions and 42 deletions

View file

@ -43,29 +43,41 @@ in
default = { }; default = { };
description = '' description = ''
Each set of channels are written to Each set of channels are written to
{file}`$XDG_CONFIG_HOME/television/NAME-channels.toml` {file}`$XDG_CONFIG_HOME/television/cable/NAME.toml`
See <https://github.com/alexpasmantier/television/blob/main/docs/channels.md> See <https://alexpasmantier.github.io/television/docs/Users/channels>
for options for options
''; '';
example = lib.literalExpression '' example = {
{ git-diff = {
my-custom = { metadata = {
cable_channel = [ name = "git-diff";
{ description = "A channel to select files from git diff commands";
name = "git-log"; requirements = [ "git" ];
source_command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\"";
preview_command = "git show -p --stat --pretty=fuller --color=always {0}";
}
{
name = "git-log";
source_command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\"";
preview_command = "git show -p --stat --pretty=fuller --color=always {0}";
}
];
}; };
} source = {
''; command = "git diff --name-only HEAD";
};
preview = {
command = "git diff HEAD --color=always -- '{}'";
};
};
git-log = {
metadata = {
name = "git-log";
description = "A channel to select from git log entries";
requirements = [ "git" ];
};
source = {
command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\"";
output = "{split: :0}";
};
preview = {
command = "git show -p --stat --pretty=fuller --color=always '{0}'";
};
};
};
}; };
enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; };
@ -84,7 +96,7 @@ in
} }
(lib.mapAttrs' ( (lib.mapAttrs' (
name: value: name: value:
lib.nameValuePair "television/${name}-channels.toml" { lib.nameValuePair "television/cable/${name}.toml" {
source = tomlFormat.generate "television-${name}-channels" value; source = tomlFormat.generate "television-${name}-channels" value;
} }
) cfg.channels) ) cfg.channels)

View file

@ -10,19 +10,19 @@
input_bar_position = "top"; input_bar_position = "top";
}; };
}; };
channels.my-custom = { channels.git-log = {
cable_channel = [ metadata = {
{
name = "git-log"; name = "git-log";
source_command = ''git log --oneline --date=short --pretty="format:%h %s %an %cd" "$@"''; description = "A channel to select from git log entries";
preview_command = "git show -p --stat --pretty=fuller --color=always {0}"; requirements = [ "git" ];
} };
{ source = {
name = "my-dotfiles"; command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\"";
source_command = "fd -t f . $HOME/.config"; output = "{split: :0}";
preview_command = "bat -n --color=always {0}"; };
} preview = {
]; command = "git show -p --stat --pretty=fuller --color=always '{0}'";
};
}; };
}; };
@ -37,18 +37,20 @@
show_preview_panel = true show_preview_panel = true
use_nerd_font_icons = false use_nerd_font_icons = false
''} ''}
assertFileExists home-files/.config/television/my-custom-channels.toml assertFileExists home-files/.config/television/cable/git-log.toml
assertFileContent home-files/.config/television/my-custom-channels.toml \ assertFileContent home-files/.config/television/cable/git-log.toml \
${pkgs.writeText "channels-expected" '' ${pkgs.writeText "channels-expected" ''
[[cable_channel]] [metadata]
description = "A channel to select from git log entries"
name = "git-log" name = "git-log"
preview_command = "git show -p --stat --pretty=fuller --color=always {0}" requirements = ["git"]
source_command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\""
[[cable_channel]] [preview]
name = "my-dotfiles" command = "git show -p --stat --pretty=fuller --color=always '{0}'"
preview_command = "bat -n --color=always {0}"
source_command = "fd -t f . $HOME/.config" [source]
command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\""
output = "{split: :0}"
''} ''}
''; '';
} }