-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config file? #897
Comments
This is currently a work in progress, with the first step (a theme.yml file replacing the EXA_COLORS environment variable) PR just being hung up on testing issues. This is technically a duplicate of #139 but I'll leave it open for discussion on what everyone would like to see feature wise for the eventual config file and ideally so we can get a few theme contributions. I'd really like to be able to offer a handful of pre-made themes to choose from when #840 can get merged. 👍 |
Looks like this will get merged here pretty soon, and with custom icon support both thanks to @gierens 🚀 🚀 |
I wanted a config file for ages to replace my collection of long shell aliases. A couple of times went looking around in the documentation, repo, online etc trying to find out how to do it. @PThorpe92 I see #840 which from what I can see is mostly about colors, with an eye to expanding later. I will patiently wait/hope for all the options to be included eventually. And appreciating I read #139 and while initially wasn't sure if there is really a benefit to config file vs shell alias I found it convincing that there is. Personally I just find things easier to read with linebreaks, comments and divided up into multiple files. Since opinions were solicited here:
|
In the hobby project I've been mucking around with lately, I'm going with a strategy of embedding a commented YAML config file as the source of default values. You can then just handle that the same way as the rest of the config file hierarchy, it centralises the default configuration, users can easily find it in one place in the project repo, and you can very easily add a few lines of code that will spit a copy out for end users. |
Awesome, those are all helpful points! I believe we will be sticking with I also think it's a good idea to be able to load a specific config as a command line argument, and I'd like to have another one that dumps the default config to stdout or a specified location. And I agree the default one should include good comments 👍 |
Hello, what's the current status of this? |
I'm never 100% sure I've grasped it all properly, but I believe according to the Filesystem Hierarchy Specification a file of the defaults should probably go in Can't say I've written enough thing warranting proper config hierarchy kinda stuff to have really followed this, but as a rule I'd say the de facto 'correct' hierarchy would be something like this:
|
It looks like it's been merged! 🎉 Since I don't speak rust, and since there appear to be no automated tests or sample config files, I have no idea how to use this. Do we know when some documentation (or anything that would serve as documentation) might be added? |
Looking through the code a bit more closely, it doesn't look like there's a way to specify defaults for most command-line flags yet. 🙁 |
There is a sample config under |
@gierens Thanks for the clarification! I appreciate the wonderful tool you and the other maintainers have built, and appreciate everything you do to improve it! |
This actually brings up a good question. When adding an actual configuration file instead of just a theme file, is that a place for specifying a default command line argument, considering the ubiquity of shell aliases? If not, what options do we have in the config file? |
Hm, I don't really see these options as mutually exclusive to be honest. One can specify defaults via the configuration file and use or overwrite those in the shell aliases. |
I would also appreciate a method to set default command line flags without using aliases. Besides providing a uniform settings across different shells, this will also make supplying Perhaps we can leave the current YAML config for theming only, and support a
|
Yeah, the current file is called YAML has comment support, so that wouldn't be a reason to not continue using YAML for that file as well. Or do you see one? |
I'm not sure I see the benefit here to this approach over a regular shell alias, specially considering an alias does exactly this already. I feel like it goes against separation of concerns to essentially create an eza'ism for making what's essentially an alias, while for the yaml approach on the other hand, it supports more verbose and explicit configuration than can be achieved with just arguments, and also gives structure and readability benefits. And also, allows for potentially more advanced configuration than is unreasonable to implement as just flags.
In cases like this, it may make more sense to just create a wrapping shell script that is invoked instead of eza directly. Also, it's likely that different tools will require different settings. I also may be overlooking something here, so I'm also really interested in hearing if you don't see it the same way. |
I have this line in my bashrc: export EZACMD="eza --group-directories-first --group --header --git --color=always --icons=always --color-scale=all --sort=time" and then I reference it across 3 other scripts. it's not the end of the world, but it's kinda ugly. I don't see a reason NOT to have (at least) a stupid simple implementation equivalent to: eza $(cat "$XDG_CONFIG_HOME/eza/config" 2>/dev/null || ...) especially considering there's already a file for themes and an |
I agree. default:
# system or user-wide defaults, like, grouping, sort by extension etc.
group_directories: first
sort: [extension,date]
long: true
icons: auto
color: auto
# etc.
extra: # just a "working" name :-p
fzf:
# --group --header --git --color=always --icons=always --color-scale=all --sort=time"
group: true
header: true
git: true
color: always
icons: always
color_scale: all # or colorScale, whatever suits you :-)
sort: time # overrides 'default'
short:
default: false # like, do not cascade from 'default'
icons: auto # overrides 'default'
sort: extension
oneline: true
ls:
default: false
# settings to mimic ls
lsd:
inherit: ls
# settings to mimic lsd but using 'ls' as base, including the default: false etc. The default group would be the one used when invoking
This approach allows having a lot of visualization and filters options "named" and easily accessible, and also easy to maintain (they would be in the configuration directory). |
One problem I am encountering these days with shell aliases is that as new features are added to eza and incorporated into my aliases, that then breaks in older versions of eza. Because the repo-packaged version of eza varies from system to system, but I like to share my shell aliases. But eza chokes on unknown argument/option. Hopefully a configuration file would have integrated from the outset some kind of no-fail mode whereby you could tell it to ignore unknown options, in anticipation of future changes. I wish I knew how to program so I could just implement the config file, instead of adding to this already very long thread. |
@CouldBeThis maybe something like this would work in the meantime? export EZA_CMD='eza --old_feature'
declare -A versions
versions=(
["--feature1"]=0.1.2
["--feature2"]=0.2.3
["--feature3"]=0.20.30
["--feature4"]=0.20.40
)
for feat in "${!versions[@]}"; do
eza --version | sed -n 's/^v\(\S*\)\s\S*$/\1/p' | xargs printf "%s\n${versions[$feat]}\n" | sort -VCr && EZA_CMD+=" $feat"
done
alias ls="$EZA_CMD" |
I think there should really be a config file for this, to set up various defaults and such. Even the colours and what have you that can be tweaked with environment variables, it seems it would surely be better to really have in a config file doesn't it?
I've hacked my way to getting it to behave how I'd like with fish abbreviations and such like, but it seeems weirdly missing like
$XDG_CONFIG_HOME/eza.conf
(or perhaps even a folder under$XDG_CONFIG_HOME
if people might want to have colour/icon themes and such?)Shouldn't really be that tricky to implement imo, it's more what kind of file format, what options, etc. people would favour?
The text was updated successfully, but these errors were encountered: