broot: improve configuration
The `invocation` is an optional attribute, so it doesn't make sense to use it as the key in an attribute set. See https://dystroy.org/broot/documentation/configuration/#verb-definition-attributes Actually, `invocation` should not be defined when one wants to rebind a built-in verb to a different key. Also added documentation for the `key` attribute.
This commit is contained in:
parent
9c14bbe988
commit
234de0270a
|
@ -9,7 +9,28 @@ section is therefore not final.
|
||||||
|
|
||||||
This release has the following notable changes:
|
This release has the following notable changes:
|
||||||
|
|
||||||
* Nothing has happened.
|
* The <<opt-programs.broot.verbs>> option is now a list rather than an
|
||||||
|
attribute set. To migrate, move the keys of the attrset into the list
|
||||||
|
items' `invocation` keys. For example,
|
||||||
|
+
|
||||||
|
[source,nix]
|
||||||
|
----
|
||||||
|
programs.broot.verbs = {
|
||||||
|
"p" = { execution = ":parent"; };
|
||||||
|
};
|
||||||
|
----
|
||||||
|
+
|
||||||
|
becomes
|
||||||
|
+
|
||||||
|
[source,nix]
|
||||||
|
----
|
||||||
|
programs.broot.verbs = [
|
||||||
|
{
|
||||||
|
invocation = "p";
|
||||||
|
execution = ":parent";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
----
|
||||||
|
|
||||||
[[sec-release-21.03-state-version-changes]]
|
[[sec-release-21.03-state-version-changes]]
|
||||||
=== State Version Changes
|
=== State Version Changes
|
||||||
|
|
|
@ -1736,6 +1736,29 @@ in
|
||||||
A new module is available: 'programs.i3status-rust'.
|
A new module is available: 'programs.i3status-rust'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2020-11-14T13:02:40+00:00";
|
||||||
|
condition = config.programs.broot.enable;
|
||||||
|
message = ''
|
||||||
|
The 'programs.broot.verbs' option is now a list rather than an
|
||||||
|
attribute set. To migrate, move the keys of the attrset into the
|
||||||
|
list items' 'invocation' keys. For example,
|
||||||
|
|
||||||
|
programs.broot.verbs = {
|
||||||
|
"p" = { execution = ":parent"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
becomes
|
||||||
|
|
||||||
|
programs.broot.verbs = [
|
||||||
|
{
|
||||||
|
invocation = "p";
|
||||||
|
execution = ":parent";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
brootConf = {
|
brootConf = {
|
||||||
verbs =
|
verbs = cfg.verbs;
|
||||||
mapAttrsToList (name: value: value // { invocation = name; }) cfg.verbs;
|
|
||||||
skin = cfg.skin;
|
skin = cfg.skin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,41 +53,60 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
verbs = mkOption {
|
verbs = mkOption {
|
||||||
type = with types; attrsOf (attrsOf (either bool str));
|
type = with types; listOf (attrsOf (either bool str));
|
||||||
default = {
|
default = [
|
||||||
"p" = { execution = ":parent"; };
|
{
|
||||||
"edit" = {
|
invocation = "p";
|
||||||
|
execution = ":parent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
invocation = "edit";
|
||||||
shortcut = "e";
|
shortcut = "e";
|
||||||
execution = "$EDITOR {file}";
|
execution = "$EDITOR {file}";
|
||||||
};
|
}
|
||||||
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
|
|
||||||
"view" = { execution = "less {file}"; };
|
|
||||||
};
|
|
||||||
example = literalExample ''
|
|
||||||
{
|
{
|
||||||
"p" = { execution = ":parent"; };
|
invocation = "create {subpath}";
|
||||||
"edit" = { shortcut = "e"; execution = "$EDITOR {file}" ; };
|
execution = "$EDITOR {directory}/{subpath}";
|
||||||
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
|
}
|
||||||
"view" = { execution = "less {file}"; };
|
{
|
||||||
"blop {name}\\.{type}" = {
|
invocation = "view";
|
||||||
|
execution = "less {file}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
example = literalExample ''
|
||||||
|
[
|
||||||
|
{ invocation = "p"; execution = ":parent"; }
|
||||||
|
{ invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; }
|
||||||
|
{ invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; }
|
||||||
|
{ invocation = "view"; execution = "less {file}"; }
|
||||||
|
{
|
||||||
|
invocation = "blop {name}\\.{type}";
|
||||||
execution = "/bin/mkdir {parent}/{type} && /usr/bin/nvim {parent}/{type}/{name}.{type}";
|
execution = "/bin/mkdir {parent}/{type} && /usr/bin/nvim {parent}/{type}/{name}.{type}";
|
||||||
from_shell = true;
|
from_shell = true;
|
||||||
};
|
}
|
||||||
}
|
]
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Define new verbs. The attribute name indicates how the verb is
|
Define new verbs. For more information, see
|
||||||
called by the user, with placeholders for arguments.
|
<link xlink:href="https://dystroy.org/broot/documentation/configuration/#verb-definition-attributes"/>.
|
||||||
</para><para>
|
</para><para>
|
||||||
The possible attributes are:
|
The possible attributes are:
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>invocation</literal> (optional)</term>
|
||||||
|
<listitem><para>how the verb is called by the user, with placeholders for arguments</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>execution</literal> (mandatory)</term>
|
<term><literal>execution</literal> (mandatory)</term>
|
||||||
<listitem><para>how the verb is executed</para></listitem>
|
<listitem><para>how the verb is executed</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>key</literal> (optional)</term>
|
||||||
|
<listitem><para>a keyboard key triggering execution</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>shortcut</literal> (optional)</term>
|
<term><literal>shortcut</literal> (optional)</term>
|
||||||
<listitem><para>an alternate way to call the verb (without
|
<listitem><para>an alternate way to call the verb (without
|
||||||
|
|
Loading…
Reference in a new issue