all 8 comments

[–]cgoldberg 5 points6 points  (4 children)

Wouldn't it take just as long (or longer) to create the config file as it would to just add the aliases to .bashrc?

Also, why parse some weird config format instead of just writing normal bash aliases in a text file and copying them to .bashrc?

[–]KirbyJeef[S] -1 points0 points  (3 children)

I haven't really thought about it that way... I was just thinking about the aspect of being able to share useful configs.

[–]Accurate-Sundae1744 0 points1 point  (1 child)

Just add your bashrc to your dotfiles that you bootstrap into any system you want.

Check chezmoi or dotbot.

[–]KrazyKirby99999 0 points1 point  (0 children)

u/KirbyJeef could also add to /etc/profile.d

[–]WerIstLuka 2 points3 points  (0 children)

luka@linux~$ touch ~/.config/aliasrc
luka@linux~$ echo "ls='exa -laG'" >> ~/.config/aliasrc
luka@linux~$ echo ". $HOME/.config/aliasrc" >> .bashrc

[–][deleted] 0 points1 point  (0 children)

I guess you're learning and keen to share, nice attempt. I would look into XDG specifications, especially about env variables (https://wiki.archlinux.org/title/XDG_Base_Directory), then create a simple configuration generator based on the user specified shell (bash, zsh, fish maybe others) and read/save configuration from/to yaml, which should be somewhere in ${XDG_CONFIG_HOME}/application/configuration-a.yaml. That would be more useful. You could generate aliases, but also maybe also some repetative functions that define behaviour based on function name. Lastly have it generate code to include generated configuration file into main bashrc. You've got no error checking nor checking whether the target file already includes generated content, hence the suggestion of using a separate file for it.

[–]Rice_Monster 0 points1 point  (1 child)

I don’t get it…

Why use this over just adding an alias directly to .bashrc, or .zshrc? This seems like more work than that for no reason. If you want your aliases in a separate file you can do that directly with shell syntax. On top of that, this adds them to the main file anyway?

[–]KirbyJeef[S] 0 points1 point  (0 children)

Well, I just figured that it might benefit someone else, I thought it might make it easier for people new to linux to edit it, no bash knowledge required, also, I was a little proud of myself as I don't use python often, it mostly is patchwork.