3 unstable releases
0.2.0 | May 18, 2021 |
---|---|
0.1.1 | Nov 22, 2020 |
0.1.0 | Nov 22, 2020 |
#16 in #node-modules
14KB
254 lines
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.
[felt]
root = true
node_modules = true
[command]
hello = "echo Hello! I\\'m Felt!"
nid = "npm install --save-dev"
You have defined hello
command above. Let's execute it
felt hello
You will get output Hello! I'm Felt!
.
You can also execute them with args.
felt nid esbuild react react-dom
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.
npm install esbuild
# This execute ./node_modules/.bin/esbuild
felt esbuild index.js --minify --oufile build/index.js
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.
[felt]
# 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.
root = 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.
node_modules = true
[command]
# You can define yor command aliases!
# felt redis-up
redis-up = "docker run -it --rm -p 6379:6379 redis"
# felt countfiles
countfiles = "ls -l | wc -l"
List all your commands
felt --list
or
felt -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:
[felt]
root = true
node_modules = false
[command]
hello = "echo Hello"
hello2 = "echo Hi"
And ~/myproject/.feltrc.toml
is:
[felt]
node_modules = true
[command]
hello = "echo Helloooooooooooooooo"
You can:
cd ~/myproject
felt hello
felt hello2
Dependencies
~0.5–1.5MB
~29K SLoC