mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-05 08:31:03 +01:00
fish: added abbr.name option
This commit is contained in:
parent
3670a78eee
commit
7538d96535
2 changed files with 19 additions and 2 deletions
|
|
@ -166,6 +166,14 @@ let
|
||||||
|
|
||||||
abbrModule = types.submodule {
|
abbrModule = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
name = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The abbreviation name that is replaced by the expansion.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
expansion = mkOption {
|
expansion = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
|
@ -289,8 +297,9 @@ let
|
||||||
|
|
||||||
abbrsStr = lib.concatStringsSep "\n" (
|
abbrsStr = lib.concatStringsSep "\n" (
|
||||||
lib.mapAttrsToList (
|
lib.mapAttrsToList (
|
||||||
name: def:
|
attrName: def:
|
||||||
let
|
let
|
||||||
|
name = if isAttrs def && def.name != null then def.name else attrName;
|
||||||
mods =
|
mods =
|
||||||
lib.cli.toGNUCommandLineShell
|
lib.cli.toGNUCommandLineShell
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,19 @@
|
||||||
command = "git";
|
command = "git";
|
||||||
expansion = "checkout";
|
expansion = "checkout";
|
||||||
};
|
};
|
||||||
s = {
|
status = {
|
||||||
|
name = "s";
|
||||||
command = [
|
command = [
|
||||||
"git"
|
"git"
|
||||||
"hg"
|
"hg"
|
||||||
];
|
];
|
||||||
expansion = "status";
|
expansion = "status";
|
||||||
};
|
};
|
||||||
|
show = {
|
||||||
|
name = "s";
|
||||||
|
command = "systemctl";
|
||||||
|
expansion = "show";
|
||||||
|
};
|
||||||
dotdot = {
|
dotdot = {
|
||||||
regex = "^\\.\\.+$";
|
regex = "^\\.\\.+$";
|
||||||
function = "multicd";
|
function = "multicd";
|
||||||
|
|
@ -79,6 +85,8 @@
|
||||||
"abbr --add --command git -- co checkout"
|
"abbr --add --command git -- co checkout"
|
||||||
assertFileContains home-files/.config/fish/config.fish \
|
assertFileContains home-files/.config/fish/config.fish \
|
||||||
"abbr --add --command git --command hg -- s status"
|
"abbr --add --command git --command hg -- s status"
|
||||||
|
assertFileContains home-files/.config/fish/config.fish \
|
||||||
|
"abbr --add --command systemctl -- s show"
|
||||||
assertFileContains home-files/.config/fish/config.fish \
|
assertFileContains home-files/.config/fish/config.fish \
|
||||||
"abbr --add --function multicd --regex '^\.\.+$' -- dotdot"
|
"abbr --add --function multicd --regex '^\.\.+$' -- dotdot"
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue