Releases: marcelarie/nu-alias-converter
v0.1.3
This release marks the first official version of Nushell Alias Converter, a tool for converting Bash aliases into Nushell aliases. The project is primarily for educational purposes, allowing exploration of Tree-sitter, Rust, and Nushell parsing. However, it offers practical utility for those migrating their Bash aliases to Nushell!
Features
-
Convert Bash Aliases to Nushell: The core functionality converts
.bash_aliases
to a Nushell-compatible format and outputs it as a.nu
file. -
Seamless Nushell Integration: The tool regenerates the converted alias file at the start of each Nushell session, ensuring your environment remains in sync with any updates to your Bash aliases.
-
Alias Ignoring: Customize which aliases are excluded from the conversion using a
.aliasignore
file. You can ignore aliases by name or by the command they run.Example
.aliasignore
file:ls !htop
🛠 Installation
Install the converter via Cargo:
cargo install nu-alias-converter
Usage
To convert your Bash aliases to Nushell, run:
nu-alias-converter .bash_aliases
For Nushell integration, add the following to your env.nu
file:
nu-alias-converter ~/.bash_aliases -o $"($nu.default-config-dir)/bash-aliases.nu" | ignore
Then, source it in your config.nu
:
source bash-aliases.nu
Error Handling and Comments
- Invalid or unrecognized aliases are commented out, along with information on the parsing error, so you can manually adjust them if needed.
Performance
- Parallelized Conversion: Using Rayon, the tool converts even large alias files quickly, improving performance dramatically (tested with a 28,888-line alias file).
What's Next?
- Support for handling multiple files in a directory.
- Improved handling for Zsh and Fish alias scripts.
- Enhancements for recursive alias expansion (
expand_aliases
andshopt -s expand_aliases
).
This release is the first step towards making the migration between Bash and Nushell easier, while also serving as a learning platform for better parsing and Rust development practices.