| Crates.io | inflekt |
| lib.rs | inflekt |
| version | 0.3.0 |
| created_at | 2020-09-17 22:32:52.240805+00 |
| updated_at | 2020-09-25 21:12:06.155578+00 |
| description | Inflects input in a bunch of cases |
| homepage | https://gitlab.com/vise890/inflektor/ |
| repository | https://gitlab.com/vise890/inflektor/ |
| max_upload_size | |
| id | 289924 |
| size | 9,114 |
Inflects input in a bunch of cases.
Mainly to perform search and replace with tools like ripgrep or fastmod.
cargo install inflekt
➜ inflekt foo-bar
foobar
FOOBAR
fooBar
FooBar
foo-bar
Foo-Bar
foo_bar
FOO_BAR
➜ inflekt foo-bar beep-boop
foobar beepboop
FOOBAR BEEPBOOP
fooBar beepBoop
FooBar BeepBoop
foo-bar beep-boop
Foo-Bar Beep-Boop
foo_bar beep_boop
FOO_BAR BEEP_BOOP
# interactively replace all inflections of foo-bar with corresponding
# inflection of beep-boop
➜ xargs \
--arg-file <(inflekt foo-bar beep-boop) \
--max-lines=1 \
fastmod
# grep for all inflections of foo-bar
➜ rg "($(inflekt foo-bar | xargs | sed 's/ /)|(/g'))"
# NOTE: the magic inside the quotes just turns the inflekt output into a regex:
➜ echo "($(./target/debug/inflekt foo-bar | xargs | sed 's/ /)|(/g'))"
(foobar)|(FOOBAR)|(fooBar)|(FooBar)|(foo-bar)|(Foo-Bar)|(foo_bar)|(FOO_BAR)