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 = { };
description = ''
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
'';
example = lib.literalExpression ''
{
my-custom = {
cable_channel = [
{
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}";
}
{
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}";
}
];
example = {
git-diff = {
metadata = {
name = "git-diff";
description = "A channel to select files from git diff commands";
requirements = [ "git" ];
};
}
'';
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; };
@ -84,7 +96,7 @@ in
}
(lib.mapAttrs' (
name: value:
lib.nameValuePair "television/${name}-channels.toml" {
lib.nameValuePair "television/cable/${name}.toml" {
source = tomlFormat.generate "television-${name}-channels" value;
}
) cfg.channels)

View file

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