Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 18, 2021 10:19 pm GMT

Oh my Tomtit - alternative to oh my zsh written on Raku

Oh My Zsh is quite poplar ecosystem allows people to run useful scenarios to customize their terminals as well to deal with typical tasks.

A couple years ago I created the Tomtit and since then this has been bothering me - how similar it is to what ohmyzsh does ...

Well, not exactly, but it's written on Raku.

Brief comparison with ohmyzsh

  • Tomit allows to write portable scripts and execute them to satisfy users' needs. The same what ohmyzsh plugins do

  • Unlike ohmyzsh plugins which are written on Zshell, Tomtit plugins could be written on similar Bash or many other languages supported by Sparrow ( on which the Tomtit is built on )

  • Unlike ohmyzsh scenarios, Tomtit scenarios get run as Raku scripts and thus are highly customizable. In ohmyzsh you only have shell aliases or functions

  • Ohmyzh has 275+ plugins which is a little bit more then Sparrow has - 216 plugins, however the difference is not that big, considering that the only Sparrow maintainer is me :-).

Brief example

Every time I work with git I need this helpers that easy my work. With Tomtit I'd do this:

tom --profile git

output:

install git@commit ...install git@git-branch-delete ...install git@git-publish ...install git@git-summary ...install git@pull ...install git@push ...install git@set-git ...install git@status ...install git@update-branch-list ...

And then set-up my git config for this project:

tom --edit set-git
#!rakutask-run "set git", "git-base", %(  email => '[email protected]',  name  => 'Alexey Melezhik',  config_scope => 'local',  set_credential_cache => 'on');

And apply it:

tom set-git

output:

[repository] :: index updated from file:///root/repo/api/v1/index[set git] :: git credential.helper cache --timeout=3000000[set git] :: git user.email [email protected][set git] :: git user.name Alexey Melezhik[task check] stdout match <git user.email [email protected]> True[task check] stdout match <git user.name Alexey Melezhik> True

That is it!

Now I only need to commit my configuration into git:

echo ".cache" >> .gitignoregit add .tomgit commit -a -m "my tomtit helpers for git"git push

Tomtit profiles

Tomtit profiles are predefined user scripts grouped by categories:

tom --profile

output:

adoazuregitgitlabhelloperlrakurubyyaml

When you install a profile you install all scripts into .tom directory. For example, as we did for git:

tom --profile --list git

output:

[profile scenarios]git@commit      installed: Truegit@git-branch-delete   installed: Truegit@git-publish installed: Truegit@git-summary installed: Truegit@pull        installed: Truegit@push        installed: Truegit@set-git     installed: Truegit@status      installed: Truegit@update-branch-list  installed: True

We've ended up having several git-* scripts in .tom directory.

Profile scripts are just Raku scripts invoking one or more Sparrow plugins. That's it. Tomtit would generate some reasonable stubs for .tom/ Raku scripts but you are always free to edit the ones.

For example as we did for set-git:

tom --edit set-git

It allows you to generate some boilerplate code but then modify it upon your needs.

Conclusion

Tomtit and Sparrow could be a reasonable alternative to ohmyzsh with pros mentioned above. Of course, some things like exporting shell aliases won't work with in Tomtit ( but there is workaround for that), however other command line tasks could be executed via Tomtit in very efficient way.

I am looking for new (Raku?) contributors for the project.

And thank you for reading.

Alexey.


Original Link: https://dev.to/melezhik/oh-my-tomtit-alternative-to-oh-my-zshell-written-on-raku-4oc5

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To