felt - Defines aliases and executes them.
felt is a simple command runner, written in Rust.
Install
Install Rust first. Then you can use cargo command to install felt.
cargo command is bundled with Rust.
cargo install felt
Supported OS
| Family | Supported | Note |
|---|---|---|
| Windows | 🚧 | |
| macOS(Intel) | ✅ | |
| macOS(Apple Silicon) | ❓ | |
| Linux | ✅ |
Usage
Put a .feltrc.toml file in your home directory, which means ~/.feltrc.toml file.
[]
= true
= true
[]
= "echo Hello! I\\'m Felt!"
= "npm install --save-dev"
You have defined hello command above. Let's execute it
You will get output Hello! I'm Felt!.
You can also execute them with args.
Execute node_modules
felt can execute command in ./node_modules/.bin/ directly. If you want this feature, set node_modules in .feltrc.toml to true.
# You may have some Node.js binaries.
# This execute ./node_modules/.bin/esbuild
Notice: Currently, felt searches node_modules in just current execution directory. Even if other related directory has node_modules, felt cannot find it.
.feltrc.toml
.feltrc.toml is config file for felt. It may be put in home directory.
[]
# If root is true, felt doesn't see parent directory's .fetlrc.toml
# If this file is in home, you should set root to true.
# You can omit this line when it is false.
= true
# If node_modules is true, felt can run binaries in ./node_modules/.bin/
# If false, disable the feature.
# If omit this line, its value is inherit from parent, or false when no parents set any value.
= true
[]
# You can define yor command aliases!
# felt redis-up
= "docker run -it --rm -p 6379:6379 redis"
# felt countfiles
= "ls -l | wc -l"
Local .feltrc.toml
felt uses .feltrc.toml in below order.
- current directory
- parent directory
- parent of parent...(recursively)
If current directory is out of home(e.g. /tmp/), append ~/.feltrc.toml to last of above list.
If felt found root = true file. felt stops traverse there.
For example, home .feltrc.toml is:
[]
= true
= false
[]
= "echo Hello"
= "echo Hi"
And ~/myproject/.feltrc.toml is:
[]
= true
[]
= "Helloooooooooooooooo"
You can: