mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 09:39:45 +01:00
exa
: add more options (#3505)
* exa: add more options * exa: use `escapeShellArgs` * exa: don't hardcode executable path in aliases Prevents aliases from going stale in open terminals when the system is updated. * exa: use `command` for self-referential alias Otherwise fish complains about the recursive call. Drop the aliases from ion shell since it doesn't implement the POSIX `command` built-in. * exa: re-add ion aliases * exa: drop `command` Fish doesn't complain about recursion if `exa` isn't escaped. --------- Co-authored-by: Naïm Favier <n@monade.li>
This commit is contained in:
parent
305daba44a
commit
4bac341868
1 changed files with 43 additions and 14 deletions
|
@ -2,19 +2,7 @@
|
|||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.exa;
|
||||
|
||||
aliases = {
|
||||
ls = "${pkgs.exa}/bin/exa";
|
||||
ll = "${pkgs.exa}/bin/exa -l";
|
||||
la = "${pkgs.exa}/bin/exa -a";
|
||||
lt = "${pkgs.exa}/bin/exa --tree";
|
||||
lla = "${pkgs.exa}/bin/exa -la";
|
||||
};
|
||||
|
||||
in {
|
||||
{
|
||||
meta.maintainers = [ hm.maintainers.kalhauge ];
|
||||
|
||||
options.programs.exa = {
|
||||
|
@ -23,10 +11,51 @@ in {
|
|||
|
||||
enableAliases = mkEnableOption "recommended exa aliases";
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--group-directories-first" "--header" ];
|
||||
description = ''
|
||||
Extra command line options passed to exa.
|
||||
'';
|
||||
};
|
||||
|
||||
icons = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Display icons next to file names (<option>--icons</option> argument).
|
||||
'';
|
||||
};
|
||||
|
||||
git = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
List each file's Git status if tracked or ignored (<option>--git</option> argument).
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "exa" { };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = let
|
||||
cfg = config.programs.exa;
|
||||
|
||||
args = escapeShellArgs (optional cfg.icons "--icons"
|
||||
++ optional cfg.git "--git" ++ cfg.extraOptions);
|
||||
|
||||
aliases = {
|
||||
# Use `command` instead of hardcoding the path to exa so that aliases don't
|
||||
# go stale after a system update.
|
||||
exa = "exa ${args}";
|
||||
ls = "exa";
|
||||
ll = "exa -l";
|
||||
la = "exa -a";
|
||||
lt = "exa --tree";
|
||||
lla = "exa -la";
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
|
||||
|
|
Loading…
Reference in a new issue