A simple word counter

Give the word and count the appearance.

The first rust project of mine.

Install

cargo install wcounter

Usage

```

wcounter --dest-file="path/to/file" add some_word wcounter --dest-file="path/to/file" show

some_word ... ```

Integrated with Zsh and FZF

Inspired by the entry

``` typeset -U chpwd_functions

save the current directory after cd

CDHISTORYFILE=${HOME}/.cdhistoryfile # cd history filcd history file function chpwdrecordhistory() { echo $PWD | xargs wcounter --dest-file=${CDHISTORYFILE} add } chpwdfunctions=($chpwdfunctions chpwdrecordhistory)

load the cd history

function fd(){ dest=$(wcounter --dest-file=${CDHISTORYFILE} show --reverse | fzf +m --query "$LBUFFER" --prompt="cd > ") cd $dest }

```

File locking

To avoid conflict of the output file by written simultaneously by multiple process, wcounter uses fslock as file locking.

The lock file will be created at {dest_file_path}.lock, and will reused by another process, so the lock file will not deleted.