Give the word and count the appearance.
The first rust project of mine.
cargo install wcounter
Add the words to wcounter, And It show the word list in order of appearances.
```
wcounter --dest-file="path/to/file" add someword wcounter --dest-file="path/to/file" add someword2 wcounter --dest-file="path/to/file" add someword3 wcounter --dest-file="path/to/file" add someword2
wcounter --dest-file="path/to/file" show
someword someword3 some_word2
wcounter --dest-file="path/to/file" show --reverse
someword2 someword3 some_word ... ```
Inspired by the entry
``` typeset -U chpwd_functions
CDHISTORYFILE=${HOME}/.cdhistoryfile # cd history filcd history file function chpwdrecordhistory() { echo $PWD | xargs wcounter --dest-file=${CDHISTORYFILE} add } chpwdfunctions=($chpwdfunctions chpwdrecordhistory)
function fd(){ dest=$(wcounter --dest-file=${CDHISTORYFILE} show --reverse | fzf +m --query "$LBUFFER" --prompt="cd > ") cd $dest }
```
To avoid conflict of the output file by written simultaneously by multiple process, wcounter uses cluFlock.The lock file will be created at {dest_file_path}.lock
, and will be reused by another process, so the lock file not deleted automatically.